2 minute read

After exchanging a few emails with Stephen Hill, he clarified how they were able to cull shadows from the scene using the Hierarchical Z-Buffer (HZB).  The purpose of mentioning the paper CC Shadow Volumes, was just to point out the source that gave them the inspiration.  Their solution to culling the shadows was actually really simple, I was kicking myself for not seeing it sooner.

I may try to throw together a shadow sample that demonstrates this, but it’s so straight forward I figured I would go ahead and post the explanation in case I never get around to coding up a version with this implemented in there.

Shadow Culling Steps

  1. Create a HZB from the point of view of the player.
  2. Create a HZB from the point of view of the shadow casting light.
  3. Cull the shadow casting objects using the lights HZB. 1. If the object is culled, mark it as culled.
  4. If the object isn’t culled, we need to compute a rough approximation of the extents of shadow volume.  You can think of this volume as being the minimum depth points on your bounding box (A-D) and the maximum depth sampled from where those points project onto the light’s HZB (E-H) (Figure 1).  Now that you have a bounding volume for the shadow, you can transform that volume into the camera space of the player, and test it against the player’s HZB; just as if the extents were any other object you were attempting to cull with the HZB (Figure 2).  If you can’t see the volume, you can write out that the caster is culled, otherwise write it as visible.

HI-Z Shadow
Figure 1

From Eye
Figure 2