boxCull DSO

This DSO is under development.

Introduction

The boxCull DSO is intended to enhance the performance of the boxClip DSO by enabling Performer to do proper culling against the the same box against which we are clipping.

Perhaps this DSO should be folded into the boxClip DSO.

What it is

The boxCull DSO culls objects by adding Performer pre-cull callbacks to specified named pfNodes. The culling can be applied to or removed from specific nodes based on commands received through dtk shared memory.

The idea here is that we don't want to apply these pre-cull callbacks to all nodes because of the impact on performance during scene graph traversal, and because we might not be clipping all nodes against the specified 3D box. The ability to specify which nodes get the pre-cull callback enables the user to apply culling only when it is really needed.

How to use it

The coordinates of the 3D box are obtained from an area of memory pointed to by a pointer provided by a call to getRubberbandBoxPtr(). This call is currently only provided by the rubberbandBox DSO; see the rubberbandBox DSO documentation. These coordinates are obtained every frame during the postFrame callback. Note that this scheme results in some problems associated with frame accuracy (synchronization).

Commands may be provided to the DSO through dtk shared memory. The name of the shared memory is provide through the environment variable BOX_CULL_CMD_SHM. If this environment variable is not specified, the name boxCullCmd is used. The commands are in ascii and take one of these forms:

The first form applies culling to the indicated node in the scene graph, and the second form removes culling from the indicated node.

Note that this DSO will only improve performance for models that are broken up into multiple pfGeoSets such that some pfGeoSets can be culled out while still displaying all of the geometry that falls within the specified 3D box.

Example

Here is a fragment of a shell script for running savgfly (diversifly) using this DSO. It actually uses a collection of DSOs working together: rubberbandBox, slb, boxClip, boxCull, and noClipWorldNode.

 
   export SLB_1="rubberbandBoxButton"

   export DF_DSO=":noClipWorldNode:slb:rubberbandBox:boxClip:boxCull"

   savgfly -$device box.savg  P01.sge

The slb DSO will put button presses for wand button 1 into the dtk shared memory named rubberbandBoxButton, which is where the DSO rubberbandBox will look for it. The rubberbandBox DSO will display its wireframe model of the box under the noClip scene graph node because the noClipWorldNode DSO has been loaded.

The boxClip and boxCull DSOs will pick up the box coordinates by calling a routine provided by the rubberbandBox DSO.

In this example the file P01.sge looks like this:
 
    LOAD hugeModel.pfb bigNode
    ON P01 world

When the shell script is run, the models in box.savg and hugeModel.pfb are displayed and are clipped to the 3D box generated by rubberbandBox. The user can interactive change the box using the wand position and button 1 on the wand.

If the model in the file hugeModel.pfb is causing performance to be too slow, the user can issue the shell command:


    dtk-writeLine BoxCullCmdShm 1000 "cull bigNode"

to apply culling to that object. This puts the string "cull bigNode" into dtk shared memory where it will be read and acted upon by the boxCull DSO. Of course, this shell command could also be issued indirectly by a mechanism like a menu selection.

See also

DSOs: boxClip, rubberbandBox, boxVolSlice


Last revision: John Hagedorn, May 9, 2005