public

Inheritance Graph

graph BT
	HOMRenderer
	HOMRenderer --> State
	click HOMRenderer "classMinSG_1_1HOMRenderer"
	click State "classMinSG_1_1State"

Description

Occlusion culling renderer which implements Hierarchical Occlusion Maps (HOM) presented in the article mentioned below.

Author: Benjamin Eikel

Date: 2008-09-07 (original as AbstractOctreeRenderer), 2009-07-24 (porting to State )

See also: http://portal.acm.org/citation.cfm?doid=258734.258781

Protected Attributes

   
   
GroupNode * rootNode
   
unsigned int sideLength
   
unsigned int numLevels
   
std::vector< Util::Reference < Rendering::Texture > > homPyramid
   
float maxOccluderDepth
   
bool showOnlyOccluders
   
bool showHOMPyramid
   
bool showCulledGeometry
   
float minOccluderSize
   
unsigned int maxOccluderComplexity
   
unsigned long triangleLimit
   
Util::Reference < Rendering::FBO > fbo
OpenGL frame buffer object for off-screen rendering.
   
std::deque< GeometryNode * > occluderDatabase
   
Util::Reference < Rendering::Shader > occluderShader
   
unsigned int pyramidTests
   
unsigned int pyramidTestsVisible
   
unsigned int pyramidTestsInvisible
   
unsigned int culledGeometry

Public Functions

   
   
  HOMRenderer(unsigned int pyramidSize)
   
  HOMRenderer(const HOMRenderer & source)
Copy constructor.
   
  HOMRenderer( HOMRenderer && void)
Move constructor.
   
  ~HOMRenderer()
Destructor. Frees the HOM pyramid memory.
   
void initOccluderDatabase()
Collect possible occluders into the occluder-database.
   
bool setSideLength(unsigned int pyramidSize)
   
unsigned int getSideLength() const
   
void setMaxOccluderDepth(float maxDepth)
   
float getMaxOccluderDepth() const
   
void setShowOnlyOccluders(bool onlyOccluders)
   
bool getShowOnlyOccluders() const
   
void setShowHOMPyramid(bool showPyramid)
   
bool getShowHOMPyramid() const
   
void setShowCulledGeometry(bool showCulled)
   
bool getShowCulledGeometry() const
   
void setMinOccluderSize(float minSize)
   
float getMinOccluderSize() const
   
void setMaxOccluderComplexity(unsigned int maxComplexity)
   
unsigned int getMaxOccluderComplexity() const
   
void setTriangleLimit(unsigned long limit)
   
unsigned long getTriangleLimit() const
   
HOMRenderer * clone() const
Create a duplicate of this State object.

Protected Functions

   
   
void setupHOMPyramid( Rendering::RenderingContext & context)
   
void setupShader()
   
void clearOccluderDatabase()
   
void cleanupHOMPyramid()
   
void selectOccluders(std::deque< SelectedOccluder > & occluders, AbstractCameraNode * camera) const
   
double drawOccluders(const std::deque< SelectedOccluder > & occluders, FrameContext & context) const
   
bool isAreaVisible(unsigned int level, unsigned int minX, unsigned int maxX, unsigned int minY, unsigned int maxY, unsigned int bMinX, unsigned int bMaxX, unsigned int bMinY, unsigned int bMaxY) const
   
int process( Node * node, const Geometry::Vec3f & cameraPos, const Geometry::Vec3f & cameraDir, float zPlane, FrameContext & rendContext, const RenderParam & rp, const Geometry::Matrix4x4f & cameraMatrix, const Geometry::Matrix4x4f & projectionMatrix)

Documentation

variable
MinSG::HOMRenderer::rootNode

protected
 
 
GroupNode * rootNode

Root node of the scene graph which should be rendered.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:181


variable
MinSG::HOMRenderer::sideLength

protected
 
 
unsigned int sideLength

Side length in pixels of the highest resolution HOM. The value has to be a power of two and greater or equal four.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:187


variable
MinSG::HOMRenderer::numLevels

protected
 
 
unsigned int numLevels

Number of the levels in the HOM pyramid. Calculated from thesideLength.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:193


variable
MinSG::HOMRenderer::homPyramid

protected
 
 
std::vector< Util::Reference < Rendering::Texture > > homPyramid

Array of HOMs. At level 0 (index 0) there is the highest resolution HOM. The size of the HOMs is halved with each level until it reaches size 4 x 4 pixels.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:200


variable
MinSG::HOMRenderer::maxOccluderDepth

protected
 
 
float maxOccluderDepth

Set the maximum z value for occluders. Occluders which are further away should not be rendered anymore.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:206


variable
MinSG::HOMRenderer::showOnlyOccluders

protected
 
 
bool showOnlyOccluders

Instead of rendering the scene only show all occluders in the database.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:212


variable
MinSG::HOMRenderer::showHOMPyramid

protected
 
 
bool showHOMPyramid

Render the current HOM pyramid.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:217


variable
MinSG::HOMRenderer::showCulledGeometry

protected
 
 
bool showCulledGeometry

Render the geometry which was culled by the occlusion culling algorithm.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:223


variable
MinSG::HOMRenderer::minOccluderSize

protected
 
 
float minOccluderSize

Minimum projected size of an object selected as an occluder (size of bounding sphere).

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:229


variable
MinSG::HOMRenderer::maxOccluderComplexity

protected
 
 
unsigned int maxOccluderComplexity

Maximum number of triangles of an object selected as an occluder.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:234


variable
MinSG::HOMRenderer::triangleLimit

protected
 
 
unsigned long triangleLimit

Maximum number of triangles rendered in one frame for occlusion map generation.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:240


variable
MinSG::HOMRenderer::fbo

protected
 
 
Util::Reference < Rendering::FBO > fbo

OpenGL frame buffer object for off-screen rendering.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:243


variable
MinSG::HOMRenderer::occluderDatabase

protected
 
 
std::deque< GeometryNode * > occluderDatabase

List containing only occluders.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:248


variable
MinSG::HOMRenderer::occluderShader

protected
 
 
Util::Reference < Rendering::Shader > occluderShader

Shader used for rendering the occluders for the HOM.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:253


variable
MinSG::HOMRenderer::pyramidTests

protected
 
 
unsigned int pyramidTests

Storage for statistics.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:258


variable
MinSG::HOMRenderer::pyramidTestsVisible

protected
 
 
unsigned int pyramidTestsVisible

Storage for statistics.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:263


variable
MinSG::HOMRenderer::pyramidTestsInvisible

protected
 
 
unsigned int pyramidTestsInvisible

Storage for statistics.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:268


variable
MinSG::HOMRenderer::culledGeometry

protected
 
 
unsigned int culledGeometry

Storage for statistics.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:273


function
MinSG::HOMRenderer::HOMRenderer

public
     
     
HOMRenderer( unsigned int pyramidSize )

Default constructor. Reservers memory for the HOM pyramid and sets default values for members.

Parameters

pyramidSize
Side length of the HOM pyramid in pixels. It has to be greater or equal four and a power of two.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:66


function
MinSG::HOMRenderer::HOMRenderer

public
     
     
HOMRenderer( const HOMRenderer & source )

Copy constructor.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:69


function
MinSG::HOMRenderer::HOMRenderer

public
     
     
HOMRenderer( HOMRenderer && void )

Move constructor.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:72


function
MinSG::HOMRenderer::~HOMRenderer

public virtual
   
   
~HOMRenderer( )

Destructor. Frees the HOM pyramid memory.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:75


function
MinSG::HOMRenderer::initOccluderDatabase

public
   
   
void initOccluderDatabase( )

Collect possible occluders into the occluder-database.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:78


function
MinSG::HOMRenderer::setSideLength

public
     
     
bool setSideLength( unsigned int pyramidSize )

Change the pyramid size if the parameter is valid.

Parameters

pyramidSize
Side length of the HOM pyramid in pixels. It has to be greater or equal four and a power of two.

Returns

trueif the side length was changed,falseotherwise.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:88


function
MinSG::HOMRenderer::getSideLength

public const inline
   
   
unsigned int getSideLength( ) const

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:89


function
MinSG::HOMRenderer::setMaxOccluderDepth

public inline
     
     
void setMaxOccluderDepth( float maxDepth )

Set the maximum z value for occluders. Occluders which are further away should not be rendered anymore.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:97


function
MinSG::HOMRenderer::getMaxOccluderDepth

public const inline
   
   
float getMaxOccluderDepth( ) const

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:100


function
MinSG::HOMRenderer::setShowOnlyOccluders

public inline
     
     
void setShowOnlyOccluders( bool onlyOccluders )

Specify if instead of rendering the scene only all occluders in the database should be shown.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:109


function
MinSG::HOMRenderer::getShowOnlyOccluders

public const inline
   
   
bool getShowOnlyOccluders( ) const

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:112


function
MinSG::HOMRenderer::setShowHOMPyramid

public inline
     
     
void setShowHOMPyramid( bool showPyramid )

Specify if the current HOM pyramid should be shown.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:120


function
MinSG::HOMRenderer::getShowHOMPyramid

public const inline
   
   
bool getShowHOMPyramid( ) const

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:123


function
MinSG::HOMRenderer::setShowCulledGeometry

public inline
     
     
void setShowCulledGeometry( bool showCulled )

Specify if the geometry which was culled by the occlusion culling algorithm should be shown.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:132


function
MinSG::HOMRenderer::getShowCulledGeometry

public const inline
   
   
bool getShowCulledGeometry( ) const

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:135


function
MinSG::HOMRenderer::setMinOccluderSize

public inline
     
     
void setMinOccluderSize( float minSize )

Set the minimum projected size of an object to get selected as an occluder (size of bounding sphere).

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:144


function
MinSG::HOMRenderer::getMinOccluderSize

public const inline
   
   
float getMinOccluderSize( ) const

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:147


function
MinSG::HOMRenderer::setMaxOccluderComplexity

public inline
     
     
void setMaxOccluderComplexity( unsigned int maxComplexity )

Set the maximum number of triangles of an object to get selected as an occluder.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:156


function
MinSG::HOMRenderer::getMaxOccluderComplexity

public const inline
   
   
unsigned int getMaxOccluderComplexity( ) const

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:159


function
MinSG::HOMRenderer::setTriangleLimit

public inline
     
     
void setTriangleLimit( unsigned long limit )

Set the maximum number of triangles rendered in one frame for occlusion map generation.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:168


function
MinSG::HOMRenderer::getTriangleLimit

public const inline
   
   
unsigned long getTriangleLimit( ) const

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:171


function
MinSG::HOMRenderer::clone

public const virtual
   
   
HOMRenderer * clone( ) const

Create a duplicate of this State object.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:175


function
MinSG::HOMRenderer::setupHOMPyramid

protected
     
     
void setupHOMPyramid( Rendering::RenderingContext & context )

Reserves the memory for the HOM pyramid.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:278


function
MinSG::HOMRenderer::setupShader

protected
   
   
void setupShader( )

Creates the Shader.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:283


function
MinSG::HOMRenderer::clearOccluderDatabase

protected
   
   
void clearOccluderDatabase( )

Clear the occluder-database.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:288


function
MinSG::HOMRenderer::cleanupHOMPyramid

protected
   
   
void cleanupHOMPyramid( )

Frees the memory for the HOM pyramid.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:293


function
MinSG::HOMRenderer::selectOccluders

protected const
     
     
void selectOccluders( std::deque< SelectedOccluder > & occluders,
  AbstractCameraNode * camera
) const    

Select occluders in frustum.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:304


function
MinSG::HOMRenderer::drawOccluders

protected const
     
     
double drawOccluders( const std::deque< SelectedOccluder > & occluders,
  FrameContext & context
) const    

Draw selected occluders.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:309


function
MinSG::HOMRenderer::isAreaVisible

protected const
     
     
bool isAreaVisible( unsigned int level,
  unsigned int minX,
  unsigned int maxX,
  unsigned int minY,
  unsigned int maxY,
  unsigned int bMinX,
  unsigned int bMaxX,
  unsigned int bMinY,
  unsigned int bMaxY
) const    

Checks the given area inside the HOM pyramid and determines if the area is visible.

Parameters

level
Level to do the area check in.
minX
Left border of the area in the given level.
maxX
Right border of the area in the given level.
minY
Bottom border of the area in the given level.
maxY
Top border of the area in the given level.
bMinX
Left border of the area in the bottom level.
bMaxX
Right border of the area in the bottom level.
bMinY
Bottom border of the area in the bottom level.
bMaxY
Top border of the area in the bottom level.

Returns

trueif the area is visible andfalseif the area is hidden.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:327


function
MinSG::HOMRenderer::process

protected
     
     
int process( Node * node,
  const Geometry::Vec3f & cameraPos,
  const Geometry::Vec3f & cameraDir,
  float zPlane,
  FrameContext & rendContext,
  const RenderParam & rp,
  const Geometry::Matrix4x4f & cameraMatrix,
  const Geometry::Matrix4x4f & projectionMatrix
)    

Used when displaying the scene with the occlusion culling algorithm. It checks if a node is visible. If it is, it draws it and traverses the children. Otherwise the traversal is stopped at that node.

Parameters

node
Node currently visited.
cameraPos
Absolute position of the camera.
cameraDir
Normalized viewing direction of the camera.
zPlane
Maximum z coordinate of occluders that are used in the current frame.
rendContext
Current rendering context which should be used for displaying.
rendFlags
Flags which should be used for displaying.
cameraMatrix
Camera matrix that was used to render the occluders.
projectionMatrix
Projection matrix that was used to render the occluders.

Returns

Status code indicating if the traversal should be continued.

Defined in MinSG/Ext/OcclusionCulling/HOMRenderer.h:352