How to determine what geometry should be added to each cascade depth pass in a cascade shadow mapping?

Hi all,

I have implemented cascade shadow mapping in my OpenGL program, and I am having problems with the criteria at the time of choose what geometry is rendered in the depth pass of each cascade.

I have tried to do frustum culling with the projection and view matrix of the main scene camera and with the projection and view matrix of each cascade, and in both cases I have the same problem: some light occluders ( geometry ) are discarted because they are out of those frustums but their shadows should be present in the render.

This problem occurs because I am testing the frustums against the axis aligned bounding box of each piece of geometry and this bounding box wraps the geometry but not its projected shadow.

So, does anyone have a solution to select the occluders object that affect to the scene and discard those that do not?

Then likely either your shadow frusta are wrong, or your culling implementation is incorrect.

How? That doesn’t make sense.

A brief outline of cascaded shadow mapping:

  1. Split the view frustum (the actual view frustum determined by the camera) into “chunks” based upon distance from the viewpoint (depth). Each chunk is a right pyramidal frustum. This assumes that the viewing projection is a perspective projection (there isn’t much point in using cascaded shadow mapping for an orthographic projection).
  2. For each chunk, calculate its 2D projection using the light source’s projection. This will be a perspective projection for a point light source or a parallel (orthographic) projection for a directional light source (e.g. sunlight).
  3. Calculate the 2D bounding box of the 2D projection; this corresponds to the boundary of the shadow map for that chunk.
  4. Apply the inverse of the light’s projection to the bounding box to obtain the frustum. This will be a rectangular pyramid for a point light source or a rectangular prism for a directional light source.
  5. Render all geometry which intersects that frustum into the shadow map using the light’s projection.
  6. Repeat steps 2-5 for all chunks.

You end up with a series of shadow maps, one for each chunk of the view frustum. The lighting frusta for the various chunks are distinct; unlike the chunks themselves, they aren’t just depth-slices of a single parent frustum.

Maybe I’m doing something wrong, but with these pictures I try to explain two differents scenarios where happens what I explain in the first post:

( In the two images the scene schema is view from a top view )

In this first case the AABB of the shadow caster is out of all possible frustums, but its shadow should be present in the main scene.

And now another possible scenario:

In this second case if I use only each cascade frustum to determine which geometry must be present in its depth pass, it turns out that the shadow caster is only in the frustum of the cascade number two, but its shadow is also present in the cascade number 3.

Then you built your frustums wrong. Everything between the light and the scene should be in at least one of the frustums.

What’s the problem there? The fact that the object is in cascade 2 will still mean it is in shadow; you shouldn’t bother to check cascade 3 if 2 says that a point is “in shadow”.

So what? You shouldn’t be culling shadow casters against the camera frusta (“frustums”). You project each camera frustum into light-space, determine the bounding box, use that to construct a light-space frustum, and cull shadow casters to the light-space frustum.

It might help to draw a diagram where the light direction isn’t the same as the camera direction.

Sorry, I forgot to mention that I am always talking about a directional light.

Thanks about the mention that I have to cull shadow casters with the cascades light-space frustum, it was a doubt.

But isn’t it possible ( like in the first diagram ) that a shadow caster which shadow is present in the final render be out of all cascades ( light-space ) frustums?

Or in a correct Cascade Shadow Mapping technique all the shadow casters which shadows are present in the final render are always inside one of the light cascades frustum?

Not if the shadow maps cover the entire view frustum.

Yes.