2004-09-10 01:15:35 +02:00
|
|
|
|
|
|
|
VCGLib http://vcg.sf.net o o
|
|
|
|
Visual and Computer Graphics Library o o
|
|
|
|
_ O _
|
|
|
|
Copyright(C) 2004 \/)\/
|
|
|
|
Visual Computing Lab http://vcg.isti.cnr.it /\/|
|
|
|
|
ISTI - Italian National Research Council |
|
|
|
|
\
|
|
|
|
Metro, All rights reserved.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
--- Synopsis ---
|
|
|
|
|
|
|
|
'shadevis' is a tool designed to compute a per vertex, ambient occlusion term
|
|
|
|
|
|
|
|
Please, when using this tool cite the following reference:
|
|
|
|
|
|
|
|
For any question about this software please contact:
|
|
|
|
Paolo Cignoni ( p.cignoni@isti.cnr.it )
|
|
|
|
|
|
|
|
|
2004-06-09 19:18:30 +02:00
|
|
|
This value is mapped into a gray shade according to this formula
|
|
|
|
|
|
|
|
v=clamp(v,LowPass,HighPass)
|
2004-09-10 01:15:35 +02:00
|
|
|
v=(v-LowPass)/(HighPass-LowPass) /// Normalized 0..1
|
|
|
|
graylevel=GammaCorrection(v,GammaLev)
|
2004-06-09 19:18:30 +02:00
|
|
|
|
2004-09-10 01:15:35 +02:00
|
|
|
This graylevel is used in the Opengl lighting equation as follow.
|
|
|
|
Let assume that there is just a single directional light and no emissive and no specular component in the material, the gl lighting equation is:
|
2004-06-09 19:18:30 +02:00
|
|
|
|
2004-09-10 01:15:35 +02:00
|
|
|
C = Acm *Acs + Acm*Acli + (n*L)*Dcm*Dcli
|
2004-06-09 19:18:30 +02:00
|
|
|
|
2004-09-10 01:15:35 +02:00
|
|
|
where
|
|
|
|
Acm is the ambient color of the material (glMaterial or glColor if glColorMaterial is enabled)
|
|
|
|
Acs is ambient color of the scene (glLightModel)
|
|
|
|
Acli is the ambient intensity of the light (glLight)
|
|
|
|
|
|
|
|
We simply substitute the constant ambient that is usually constant, with a per vertex color, using a constant diffuse color.
|
|
|
|
|
|
|
|
Simple one line tutorial:
|
|
|
|
|
|
|
|
-- load a ply mesh, press 'enter', wait, press keys from 1 to 4.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Some useful hints:
|
|
|
|
|
|
|
|
Keys
|
|
|
|
'esc' quit
|
|
|
|
'enter' compute the sampling (sample are added so pressing the key twice is the same of using 2n sampling directions)
|
2004-06-09 19:18:30 +02:00
|
|
|
' ' add the current view to the sampling direction
|
2004-09-10 01:15:35 +02:00
|
|
|
'S' save a ply with the currently computed color.
|
|
|
|
's' smooth (average) the computed visibility among adjacent vertices
|
|
|
|
'v' toggle the rendering of directions used for the sampling.
|
|
|
|
'V' Save a Snapshot of the current View.
|
2004-06-09 19:18:30 +02:00
|
|
|
|
2004-09-10 01:15:35 +02:00
|
|
|
'tab' switch between object trackball light trackball
|
2004-06-09 19:18:30 +02:00
|
|
|
|
2004-09-10 01:15:35 +02:00
|
|
|
'l'-'L' Increase/Decrease LowPass
|
|
|
|
'h'-'H' Increase/Decrease HighPass
|
|
|
|
'p'-'p' Increase/Decrease GammaLev
|
|
|
|
|
|
|
|
'C' Toggle Lighting
|
|
|
|
'c' Toggle per vertex coloring
|
|
|
|
|
|
|
|
'a'-'A' Increase/Decrease Ambient Coefficient
|
|
|
|
'd'-'D' Increase/Decrease Diffuse Coefficient
|
|
|
|
'e'-'E' Increase/Decrease Balance between Diffuse and Ambient coefficient
|
|
|
|
'1'..'4' Some preset ambient/diffuse values ranging from standard constant ambient to a
|
2004-06-09 19:18:30 +02:00
|
|
|
|
|
|
|
options
|
|
|
|
|
2004-09-10 01:15:35 +02:00
|
|
|
-n <number> set the number of sampling direction (default 64, but 100~500 should be better)
|
2004-06-09 19:18:30 +02:00
|
|
|
-f flip normal of the surface
|
2004-09-10 01:15:35 +02:00
|
|
|
-z <float> specify the z tolerance used to decide if a vertex is visible against the zbuffer or not (default 1e-3, useful range 1e-3 .. 1e-6)
|