The optimal occlusion culling algorithm would select only the objects that are visible. In a sense, the Z-buffer selects and renders only those objects which are visible, but not before all objects are sent through the pipeline. The idea behind efficient occlusion culling algorithms is to perform some simple tests early on and so avoid sending data through much of the pipeline. Pseudocode for a general occlusion culling algorithm is shown in Figure 2, where the function isOccluded, often called the visibility test , checks whether an object is occluded. Pseudocode for a general occlusion culling algorithm.
G contains all the objects in the scene, and OR is the occlusion representation.
Depending on the particular algorithm, OR represents some kind of occlusion information. OR is set to be empty at the beginning. Consider a particular object. First we test whether the object is occluded with respect to the occlusion representation OR . If it is occluded, then it is not processed further, since we then know that it will not contribute to the image.