version 3.3

VRS::AmbientOcclusionGL Class Reference

Computes ambient occlusion textures for terrains and arbitrary triangle meshes. More...

#include <vrs/opengl/ambientocclusiongl.h>

List of all members.

Static Public Member Functions

static
UniqueTextureMapping::TexturedMeshComposite 
createLightingTextures (SO< VRS::Iterator< SO< VRS::PolygonSet > > > triangles, double texelPerUnit, SO< VRS::GLCanvas > canvas, const AOLightingConfiguration &config=AOLightingConfiguration(), const AOCreationConfiguration &creationConf=AOCreationConfiguration())
 Computes ambient occlusion textures for a set of PolygonSets.
static void createLightingTexturesCallback (SO< VRS::Iterator< SO< VRS::PolygonSet > > > triangles, double texelPerUnit, SO< VRS::GLCanvas > canvas, SO< VRS::Callback1< UniqueTextureMapping::TexturedMeshComposite & > > storageCallback, const AOLightingConfiguration &config=AOLightingConfiguration(), const AOCreationConfiguration &creationConf=AOCreationConfiguration())
 Same as above but calls storageCallback for every finished piece.
static
UniqueTextureMapping::TexturedMeshComposite 
createLightingTexturesBMP (SO< VRS::Iterator< SO< VRS::PolygonSet > > > triangles, double texelPerUnit, SO< VRS::GLCanvas > canvas, const std::string &prefix, const AOLightingConfiguration &config=AOLightingConfiguration(), const AOCreationConfiguration &creationConf=AOCreationConfiguration())
 Same as above but stores textures as BMPs with filename prefix+"lightmap"+#+".bmp".
static SO< VRS::ImagecreateLightingTexture (SO< VRS::PolygonSet > targetTris, SO< VRS::PolygonSet > environmentTriangles, SO< VRS::GLCanvas > canvas, SO< VRS::Iterator< VRS::Vector > > lightDirs, const AOCreationConfiguration &creationConf=AOCreationConfiguration())
 Does the same as the method above, but is used differently:
  • an unqique texture parameterization is assumed to be already given (via the texture coords of 'atlasTris)
  • additional 'environment triangles' are considered for lighting, but no textures are created for them Note: The size of the result is always 'maxAtlasSize'.

static SO< VRS::Iterator
< VRS::Vector > > 
createLightDirections (int num)
 The randomized light sources must be the same if multiple textures are created separately!
static void setIDBufferSize (int size=1024)
 The following methods are control parameters that affect subsequent createXXX() method calls.
static int getIDBufferSize ()
static void setMaxTextureCacheSize (int size=200 *1024 *1024)
static int getMaxTextureCacheSize ()
static void setMaxAtlasSize (int size=1024)
 The maximum size for the created lighting texture atlases.
static int getMaxAtlasSize ()
static void setFBOEnabled (bool yesNo=true)
 Disabling frame buffer objects will significantly increase the preprocessing time, but is necessary if they are not supported.
static bool getFBOEnabled ()
static void setTextureBorderWidth (int pixels=2)
 To avoid filtering artifacts, lighting is not only calculated for the regions within all triangles in texture space but also in a small border region around these triangles.
static int getTextureBorderWidth ()
static SO
< VRS::GL2::ProgramObject
getIntensityBoostProgram (bool useTexture, float minValue=0.0f, float maxValue=1.5f)
 use this program to increase the dynamic range of lighting.


Detailed Description

Computes ambient occlusion textures for terrains and arbitrary triangle meshes.

Currently, equal light intensity is assumed from all directions of the upper (up=(0,1,0)) hemisphere.


Member Function Documentation

static UniqueTextureMapping::TexturedMeshComposite VRS::AmbientOcclusionGL::createLightingTextures ( SO< VRS::Iterator< SO< VRS::PolygonSet > > >  triangles,
double  texelPerUnit,
SO< VRS::GLCanvas canvas,
const AOLightingConfiguration config = AOLightingConfiguration(),
const AOCreationConfiguration creationConf = AOCreationConfiguration() 
) [static]

Computes ambient occlusion textures for a set of PolygonSets.

Each PolygonSet must contain exclusively triangles. Passing multiple PolygonSets makes sense if scene textures are available, whose assignment to different meshes must be preserved. 'texelPerUnit' specifies the texture resolution: The texture size is chosen in a way that a length of 1 in world space is covered with 'texelPerUnit' pixels. 'canvas' Should be an arbitrary OpenGL canvas (e.g., the main canvas of the application), for which the PBufferCanvas can share the context to avoid weird VRS problems. 'config' Specifies the lighting parameters (see above). Note: If one or more meshes already contain texture coordinates for scene textures, these are moved to texture iterator 2.

If you call this method several times, call srand() before, to ensure consistent lighting (i.e., equal random direction vectors). The result is a unique texture mapping consisting of meshes, textures, and new texture coordinates (see uniquetexturemapping.h)

static void VRS::AmbientOcclusionGL::createLightingTexturesCallback ( SO< VRS::Iterator< SO< VRS::PolygonSet > > >  triangles,
double  texelPerUnit,
SO< VRS::GLCanvas canvas,
SO< VRS::Callback1< UniqueTextureMapping::TexturedMeshComposite & > >  storageCallback,
const AOLightingConfiguration config = AOLightingConfiguration(),
const AOCreationConfiguration creationConf = AOCreationConfiguration() 
) [static]

Same as above but calls storageCallback for every finished piece.

ATTENTION: This method does not store results internally. The callback is responsible for collecting the results!

static UniqueTextureMapping::TexturedMeshComposite VRS::AmbientOcclusionGL::createLightingTexturesBMP ( SO< VRS::Iterator< SO< VRS::PolygonSet > > >  triangles,
double  texelPerUnit,
SO< VRS::GLCanvas canvas,
const std::string &  prefix,
const AOLightingConfiguration config = AOLightingConfiguration(),
const AOCreationConfiguration creationConf = AOCreationConfiguration() 
) [static]

Same as above but stores textures as BMPs with filename prefix+"lightmap"+#+".bmp".

It returns a TexturedMeshComposite without texture iterator! The lightmap numbering corresponds to the entries in the result.

static SO<VRS::Image> VRS::AmbientOcclusionGL::createLightingTexture ( SO< VRS::PolygonSet targetTris,
SO< VRS::PolygonSet environmentTriangles,
SO< VRS::GLCanvas canvas,
SO< VRS::Iterator< VRS::Vector > >  lightDirs,
const AOCreationConfiguration creationConf = AOCreationConfiguration() 
) [static]

Does the same as the method above, but is used differently:

  • an unqique texture parameterization is assumed to be already given (via the texture coords of 'atlasTris)
  • additional 'environment triangles' are considered for lighting, but no textures are created for them Note: The size of the result is always 'maxAtlasSize'.

static SO<VRS::Iterator<VRS::Vector> > VRS::AmbientOcclusionGL::createLightDirections ( int  num  )  [static]

The randomized light sources must be the same if multiple textures are created separately!

static void VRS::AmbientOcclusionGL::setIDBufferSize ( int  size = 1024  )  [static]

The following methods are control parameters that affect subsequent createXXX() method calls.

The resolution of the idBuffer affets the precision in which it is determined whether a point is shadowed or not. This parameter should later be chosen automatically.

static int VRS::AmbientOcclusionGL::getIDBufferSize (  )  [static]

static void VRS::AmbientOcclusionGL::setMaxTextureCacheSize ( int  size = 200 *1024 *1024  )  [static]

static int VRS::AmbientOcclusionGL::getMaxTextureCacheSize (  )  [static]

static void VRS::AmbientOcclusionGL::setMaxAtlasSize ( int  size = 1024  )  [static]

The maximum size for the created lighting texture atlases.

static int VRS::AmbientOcclusionGL::getMaxAtlasSize (  )  [static]

static void VRS::AmbientOcclusionGL::setFBOEnabled ( bool  yesNo = true  )  [static]

Disabling frame buffer objects will significantly increase the preprocessing time, but is necessary if they are not supported.

static bool VRS::AmbientOcclusionGL::getFBOEnabled (  )  [static]

static void VRS::AmbientOcclusionGL::setTextureBorderWidth ( int  pixels = 2  )  [static]

To avoid filtering artifacts, lighting is not only calculated for the regions within all triangles in texture space but also in a small border region around these triangles.

When rendering lighting textures without mipmapping, a border width of 2 (default) is usually sufficient. Note: The texture border widths is currently only considered by the FBO implementation.

static int VRS::AmbientOcclusionGL::getTextureBorderWidth (  )  [static]

static SO<VRS::GL2::ProgramObject> VRS::AmbientOcclusionGL::getIntensityBoostProgram ( bool  useTexture,
float  minValue = 0.0f,
float  maxValue = 1.5f 
) [static]

use this program to increase the dynamic range of lighting.

Requires the AO textures to be specified in a sampler variable called "AOTex" and an additional color texture given via a sampler variable "ColorTex" if useTexture==true Texture coordinates need to be passed in unit 0 for the AO textures and in unit 1 for color textures


The documentation for this class was generated from the following file:

Generated on Fri May 18 06:00:21 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact