Time for action—adding occluders to a complex scene

The scene which demonstrates how to use occlusion culling should have two parts: a huge number of geometries that must be culled sometime to improve the efficiency, and a few good enough osg::OccluderNode instances as occluders. Here we are going to create massive data once more, and create an occluder plane, which can speed up the rendering by removing quads that are behind it from the graphics pipeline.

  1. Include the necessary headers:
    #include <osg/Geometry>
    #include <osg/Geode>
    #include <osgViewer/ViewerEventHandlers>
    #include <osgViewer/Viewer>
    
  2. The massive quads creation function is listed here again. It is really helpful in this chapter's examples, but not good for practical use:
    #define RAND(min, ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.