I am trying to implement CSM technique with "Fit to Cascade" projections. My problem is to find good distances to partitioning the cameras view frustum. The FoV of my camera is changing, so the partitioning for the CSM algorithm need to be changed as well with respect to the FoV angle.

My shadowMap texture is a Texture2dArray which will be filled by layered rendering technique. So unlike some CSM tutorials, the shadowMap of each cascade has the same resolution.

What formular can I use to have a mostly 1 to 1 mapping of camera viewSpace pixel to shadowMap pixel?

An example to show what is meant:

For a 90° FoV, the far cascades should always be larger.

For a 10° FoV, the far cascades should be much smaller than the cascades for the 90° Fov to have a better 1 to 1 match

  • $\begingroup$ It's worth noting that if you change the FoV continuously in real time and change the CSM partitioning smoothly as well, it will cause the shadows to shimmer as the size and position of texels changes. $\endgroup$ Commented Oct 11, 2022 at 20:54
  • 1
    $\begingroup$ I'll not change the FoV continuously... It will be defined by starting the program... But the user can choose between 10° and 120° $\endgroup$
    – Thomas
    Commented Oct 11, 2022 at 21:02

1 Answer 1


The logarithmic shadow mapping split scheme produces split points that minimize aliasing. There is a short derivation that can be used to show that it produces the split points that reduce aliasing to values near 1. Here is the calculation:

$C^{log}_i = z_n(\frac{z_f}{z_n})^\frac{i}{m}$

where $i$ is the ith cascade and m is the total number of cascades.

Chose $z_n$ carefully. Often it is better to use a "virtual" near plane chosen to maximize coverage and reduce wasted shadow map space. (A poorly chosen near plane can cause an entire cascade to produce no meaningful data) Also, keep in mind that shadows closer to the camera then the chosen near plane will still produce shadows but may have higher aliasing. There are algorithms for choosing a virtual near plane I recommend looking them up.

While $C^{log}_i$ will produce split points that minimize aliasing, it will generally not give the best coverage for distant shadows(where the majority of the geometry is rendered). And a better scheme (published in several places) is to use something called the "practical" or "weighted" algorithm. It combines a uniform distribution with the logarithmic distribution. Here is its calculation: (just a simple lerp)

$C^{pract}_i = \alpha C^{log}_i + (1-\alpha)C^{uni}_i$

where $C^{uni}_i$ is:

$C^{uni}_i= n + (f-n)\frac{i}{m}$

This makes it easy to adjust between full logarithmic and uniform split.

Most of this info is readily available but the bit about choosing Z near is glossed over in most publications.

Here are my sources: My used copy of "Real-Time Shadows" and GPU Gems 3 chapter 10 (because there was an error in the book!)

  • $\begingroup$ Perfect! That is, what I was looking for $\endgroup$
    – Thomas
    Commented Oct 11, 2022 at 20:59
  • $\begingroup$ Thanks a lot! Also for the hint, that there is an error in the book. This will save me a lot of time (+1) $\endgroup$
    – Thomas
    Commented Oct 12, 2022 at 7:07
  • $\begingroup$ if I see it correctly, then the "FoV" is not taken into account. Is that correct? $\endgroup$
    – Thomas
    Commented Oct 12, 2022 at 11:47
  • $\begingroup$ Yes, aliasing in shadow mapping is mostly a function of depth and light to geometry/camera angle. But a narrow FOV will zoom distant geometry. Then the parallel projection matrix can end up with a long a narrow strip that gets sampled from when rendering shadows. Modifying the projection matrix to better fit the situation can help, modifying Z near used in the calculations can help, and modifying the alpha value used in Cpract can help. $\endgroup$
    – pmw1234
    Commented Oct 12, 2022 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.