image/svg+xml
z=0
z=1
z=0
z=1
z=0
z=1
z=0
z=1
z=0
z=1
We describe a simple occlusion culling method for determining that the green object is occluded
z = 0 is near plane, and z = 1 is far plane in illustration. First, rasterize a z-buffer using the occluders(red and blue):
Hierarchical Z-buffer Occlusion Culling: A Brief Explanation
The gray lines represent texels in the z-buffer.Now downsample the z-buffer into a mipmap-chain of textures(also called a Hierarchical Z-buffer, abbreviated HiZ-buffer). A max operator is used, so two adjacent texels are downsampled to their maximum z value:
Level 1
Notice that the last level 3 is only a single texel.Observe that each downsampled texture is a conservative estimate of the previous level. So if an object is occluded by a z-valuein level 2, then it is also occluded by the two z-values in level 1 it was downsampled from.
Level 2
Level 3
z=0
z=1
hiz_sample.z < aabb.zmin
Using the HiZ-buffer, we now implement occlusion culling: find the AABB of green object. x-min/max and y-min/maxdetermine which level of the HiZ buffer to sample from.In this case, the AABB fits in a texel in level 2, sopick that level. So from level 2, we get a conservativeestimate of the z-buffer. Since aabb.zmin is greaterthan this estimate, green object must be occluded.
And that's the occlusion culling method.Without the HiZ-buffer, we would have to take four samples to determine whether the object is occluded. The HiZ-buffer greatlydecreases the number of necessary texture samples,and is a very important optimization.
Made by Eric Arnebäck
z=0
z=1
Level 0