OpenGL Volumizer 2.7 Reference Pages


NAME
vzClipRenderAction - Render action for rendering 3D clip-textures.

INHERITS FROM
vzRenderAction

HEADER FILE
#include <Volumizer2/ClipRenderAction.h>

PUBLIC METHOD SUMMARY

   Constructor/Destructor
vzClipRenderAction (  );
virtual ~vzClipRenderAction (  );

   Set methods
void setSamplingRate ( const float samplingRate[3]);
void setLODThreshold ( const float threshold);
void setTextureMemorySize ( const unsigned long texMemSize);
void setMaxDownloadSize ( const unsigned long downloadSize);
void setMaxDrawSize ( const unsigned long downloadSize);
void enableMultiResolution (  );
void disableMultiResolution (  );

   Get methods
unsigned long getTextureMemorySize (  );
unsigned long getMaxDownloadSize (  );
unsigned long getMaxDrawSize (  );
bool isMultiResolutionEnabled (  );
int getMaxLevel ( vzShape* shape);

   Performance related methods
double getDownloadTime (  );
double getDrawTime (  );
unsigned long getDownloadSize (  );
unsigned long getDrawSize (  );

   Manage/Unmanage methods
virtual void manage ( vzShape* shape);
virtual void unmanage ( vzShape* shape);

   Draw methods
virtual void draw ( vzShape* shape);
virtual void draw ( vzShapeSet* shapeSet);
virtual void beginDraw ( unsigned int rendererFlags);
virtual void endDraw (  );
void drawWireframe ( vzShape* shape);
void setRoam ( const bool roaming);

CLASS DESCRIPTION
vzClipRenderAction implements a renderer for shapes with 3D clip-textures. The renderer can also be used to render shapes with simple volume textures, in which case, its behaviour is similar to that of the vzTMRenderAction. The renderer also provides an interface for rendering shape sets (see vzShapeSet) which can be comprised of multiple shapes.

The renderer uses the texture management system built inside the vzTMRenderAction to implement view-dependent rendering of clip-textures. It traverses the clip-texture hierarchy and supports both looking at the visible frustum along with roaming the data set using multiple levels-of-detail textures.

It uses intelligent texture paging mechanisms to improve user interaction and frame rates under certain conditions. Depending on the geometry for the shape, the renderer is capable of rendering the whole volume or a sub-cubical roaming window in the data. In this case, the render action culls all the bricks which do not intersect the shapes's geometry. It also performs view-frustum culling of bricks.

The renderer provides performance monitoring and control functionality in form of controlling the draw and texture download times. The application can explicitly set the LOD threshold values to perform resolution selection or the sampling rate for the polygonization process.

NOTES
The following are some important issues to keep in mind while using the vzClipRenderAction:


METHOD DESCRIPTIONS

   vzClipRenderAction()
vzClipRenderAction (  );

Constructor for the render action.

   ~vzClipRenderAction()
virtual ~vzClipRenderAction (  );

Destructor.

   beginDraw()
virtual void beginDraw ( unsigned int rendererFlags);

Sets the appropriate OpenGL state for drawing.

   disableMultiResolution()
void disableMultiResolution (  );

Disable multi-resolution mode rendering. When multi-resolution rendering is disabled, only texture bricks at the same level of resolution are drawn. The clip render action traverses the clip-heirarchy from the highest resolution to lower resolutions until it finds a clip-level which can be rendered in the available resources. This mode is usually more efficient when roaming the data set using a small geometry or region-of-interest, since in this mode the render action performs predictive texture downloads and provides finer control over the frame rate. Depending on the size of the data set, for large geometry, this mode will result in lower resolutions being rendered since the higher resolutions will exceed the available system resources. The amount of texture memory to be used can be modified using the setTextureMemorySize() and setMaxDrawSize() methods. Additionally, the total size of textures downloaded in a given frame can also be controlled using the setMaxDownloadSize() method.

   draw()
virtual void draw ( vzShape* shape);

Draw the given shape. The drawing will be done using the current center of interest and clip window of the clip texture. The renderer will however cull out the texture bricks which do not lie in the visible frustum of the current window or intersect the geometry for the shape. The draw method, sorts and renders the bricks in a back-to-front sorted order. The traversal scheme is governed by the mode being used to render the clip-texture (roaming vs. multi-resolution).

   draw()
virtual void draw ( vzShapeSet* shapeSet);

Draw the given vzShapeSet. The shape set consists of one or more vzShapes which will be rendered in a sorted order. When using this method, the render action takes control of managing, unmanaging and drawing the shapes in the shape in the correct visbility sorted order.

   drawWireframe()
void drawWireframe ( vzShape* shape);

A debug utility method which draws the wireframe for the bounding boxes of the texture bricks being rendered in the current frame. Use this only as a debugging tool since it can add some rendering overhead to the application.

   enableMultiResolution()
void enableMultiResolution (  );

Enable multi-resolution mode rendering. When running in "multi-resolution" mode, the vzClipRenderAction will render the clip-texture using multiple levels of detail. In this case, the bricks which are closer to the viewpoint are rendered at the highest resolution possible within the available resources. The bricks which are further away will be rendered at a lower resolution. The resolution level can be controlled using the setLODThreshold() method. The render action will only render the highest resolution bricks which fit in texture memory. The amount of texture memory to be used can be modified using the setTextureMemorySize() and setMaxDrawSize() methods. This mode will usually be useful when the geometry or the region-of-interest for the shape node is large, for example when rendering the whole volume data in a scene.

   endDraw()
virtual void endDraw (  );

Restores the OpenGL state if the rendererFlags were set appropriately.

   getDownloadSize()
unsigned long getDownloadSize (  );

Return the size of textures in bytes downloaded in the current frame.

   getDownloadTime()
double getDownloadTime (  );

Return the time taken in microseconds for texture download in the previous frame. This only an approprimate value and would not be correct if the total texture being rendered in the frame exceed the size of texture memory.

   getDrawSize()
unsigned long getDrawSize (  );

Return the total size of textures in bytes rendered in the current frame.

   getDrawTime()
double getDrawTime (  );

Return the time taken in microseconds for the actual draw of the shapes. This would include the time for the polygonization and the polygon rendering.

   getMaxDownloadSize()
unsigned long getMaxDownloadSize (  );

Get the maximum amount of texture data that the render action is allowed to download in a given frame (see setMaxDownloadSize()).

   getMaxDrawSize()
unsigned long getMaxDrawSize (  );

Get the maximum size of texture data that the render action is allowed to draw in a given frame (see setMaxDrawSize()).

   getMaxLevel()
int getMaxLevel ( vzShape* shape);

Returns the level for the higest resolution rendered in the previous frame if multi-resolution mode is disabled.

   getTextureMemorySize()
unsigned long getTextureMemorySize (  );

Get the total size of texture memory that the render action is currently allowed to use (see setTextureMemorySize()).

   isMultiResolutionEnabled()
bool isMultiResolutionEnabled (  );

Returns true if the multi-resolution mode rendering is enabled and vice-versa.

   manage()
virtual void manage ( vzShape* shape);

Manage the given shape. Currently, the renderer can manage and render only one shape. Hence, an attempt to manage a different shape would result in overwriting the previous shape. In order to render multiple clip-textures, currently you would need to create multiple render actions and divide the texture memory resources appropriately among them.

   setLODThreshold()
void setLODThreshold ( const float threshold);

Set the threshold value for selecting the level-of-detail textures to be rendered. Before selecting a brick to be rendered, the value threshold is used as a factor in comparing the brick dimensions to it's screen space projection size. Lower values imply rendering the higher resolution textures closer to the viewpoint and higher values imply rendering the coarse resolution textures. The default value for the threshold value is 5.0.

   setMaxDownloadSize()
void setMaxDownloadSize ( const unsigned long downloadSize);

Set an upper bound on the total size of textures that renderer can download in a given frame, i.e. a beginDraw/endDraw pair. This constraint, in conjunction with the LOD threshold, helps improve the interactivity of the render action by reducing the time spend in downloading textures. Setting a low value might result in rendering of lower resolution textures. This maximum texture download limit is effective only when rendering in roaming mode. The default value is 1/8th of the total texture memory size.

   setMaxDrawSize()
void setMaxDrawSize ( const unsigned long downloadSize);

Set an upper bound on the total size of textures that the renderer can draw in a given frame. This constraint, in conjunction with the LOD threshold, helps improve the interactivity of the render action by reducing the time spend in drawing textures. Setting a low value might result in rendering of lower resolution textures. The default value is equal to the texture memory size.

   setRoam()
void setRoam ( const bool roaming);

Deprecated method: Use enableMultiResolution() and disableMultiResolution() to turn on/off multi-resolution modes.

   setSamplingRate()
void setSamplingRate ( const float samplingRate[3]);

Set a sampling rate for volume rendering, defined in texture space. The default sampling rate of (1.0, 1.0, 1.0) would sample once per voxel in each texture dimension. If the application modifies this value, it should also modify the alpha component of the lookup tables, if any, to compensate for the change in the sampling density of the volume data.

   setTextureMemorySize()
void setTextureMemorySize ( const unsigned long texMemSize);

Set the total size of texture memory that the render action is allowed to use to store texture data. If not set, the render action would try to infer the texture memory size on the graphics subsytem and by default use all of the texture memory.

   unmanage()
virtual void unmanage ( vzShape* shape);

Unmanage the given shape.

SEE ALSO
vzClipRenderAction, vzRenderAction, vzShape, vzShapeSet, vzTMRenderAction

Back to Index