vcglib/apps/shadevis/shadevis.txt

120 lines
5.0 KiB
Plaintext
Raw Normal View History

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 |
\
2004-09-28 11:58:47 +02:00
ShadeVis, All rights reserved.
2004-09-10 01:15:35 +02:00
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 ---
2004-09-28 11:58:47 +02:00
'shadevis' is a tool designed to compute a per vertex, ambient occlusion term;
This term can be used for a shading effect, commonly known as ambient occlusion
shading, that is aimed to provide more faithful simple realtime rendering of rather complex meshes.
In practice tather than considering the ambient lighting to exist uniformally throughout a scene,
this approach determines the ambient brightness of each part of a surface to be proportional to the extent
to which the surface has "its outward view of its environment" free i.e. occluded, by other surfaces of the object. For example, the upper part of the David forehead is less exposed to its local environment than the nose and as a consequence it will be proportionally darker.
The most common techniques to compute ambient occlusion is based on shooting rays from each surface element to evaluate the quantity of light that reach it. Shadevis tools use OpenGL to accellerate this process by simply rendering the scene ortographically from a set of uniformely distributed directions and checking against the zbuffer if each vertex is occluded or not.
The Shadevis tool is oriented to handle rather large meshes, we have successfully used on a 8M triangle mesh of the David on a 512Mb machine.
We have used this tool also for computing the exposition of falling agent over the Michelangelo's David.
Please, when using this tool cite the following references:
R. Borgo, P. Cignoni, R. Scopigno
An easy to use visualization system for huge cultural heritage meshes
VAST<EFBFBD>01 Conference, Greece, Nov. 28-30, 2001. s
2004-09-10 01:15:35 +02:00
For any question about this software please contact:
Paolo Cignoni ( p.cignoni@isti.cnr.it )
2004-09-28 11:58:47 +02:00
---- Notes on the Color mapping ----
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.
2004-09-28 11:58:47 +02:00
Let assume that there is just a single directional light and no emissive and no specular component in the material, the OpenGL 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
2004-09-28 11:58:47 +02:00
Acm ambient color of the material (glMaterial or glColor if glColorMaterial is enabled)
Acs ambient color of the scene (glLightModel)
Acli ambient intensity of the light (glLight)
Dcm diffuse color of the material (we assume constant over the object).
2004-09-10 01:15:35 +02:00
We simply substitute the constant ambient that is usually constant, with a per vertex color, using a constant diffuse color.
2004-09-28 11:58:47 +02:00
Simple one line tutorial:
-- load a ply mesh, press 'enter', wait, press preset keys from 1 to 4.
2004-09-10 01:15:35 +02:00
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
2004-09-28 11:58:47 +02:00
'r'-'R' Increase/Decrease red component of diffuse color
'g'-'G' Increase/Decrease green component of diffuse color
'b'-'B' Increase/Decrease blue component of diffuse color
2004-09-10 01:15:35 +02:00
'C' Toggle Lighting
'c' Toggle per vertex coloring
2004-09-28 11:58:47 +02:00
'f' Toggle false color visualization
2004-09-10 01:15:35 +02:00
'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)