Jump to content
  • Advertisement
Sign in to follow this  
Quat

CSM and large frustums

This topic is 3128 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have implemented CSM and it is working. I am using 4 cascades (1024x1024). The problem is that I am still not getting enough resolution. To get very good shadows near the camera, I must use the first 3 cascades to cover the first 40 meters of the scene. Then the fourth cascade covers the rest. There is a problem: The frustum is longer than the world because the camera can move into the sky and view the scene from a far. This means the last cascade covers an area larger than the scene which is wasteful. For this reason, I modified the algorithm so that the last cascade is a tight volume around the scene. However, this is still too big of an area to cover well with a 1024x1024 map. It works well for very distant objects, but some 50 to 60 meters out still don't look good. I can move my other cascades back to cover this, but then I lose very sharp resolution near the camera. Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
Here's something I use occasionally (as a high-end option), but it does cost a little performance: make the texture larger for each more distant cascade. Limit the max size, depending on practical texture limits. Ex: for 4 splits, use 1024, 1024, 2048, 2048. Or, just make the texture for the last cascade larger. Also, don't limit yourself to powers of 2, use intermediate sizes.

Share this post


Link to post
Share on other sites
in backup? to the last post how are u choosing the frustum split size
eg
10m->20m->40m
try perhaps
10m->30m->90m

its been a few years since Ive done CSM but youve gotta choose numbers that make sense for your scene

Share this post


Link to post
Share on other sites
How about not shadowing the furthest frustums at all?
I think Armed Assault uses that technique, ant it's fine, when you have a lot of objects (trees, forest), that will occlude the scene anyway.

As for the viewing from upside, I would switch back to standard SM (switch when for example you reach a certain height).

Or an other idea, which I want to implement some day, is to combine CSM with trapezoidal SM: apply a fake/quasi-trapezoidal transformation to the shadow map matrices.

Share this post


Link to post
Share on other sites
1024 seems a little low for a CSM shadow map. 2048 is a good size, usually. In the past, I have experienced similar problems as you. Four sections in the cascade just didn't cut it for large detailed worlds.

Here's what you can do:

1) Larger shadow maps. Brute force, but it helps a lot obviously. Don't store the entire cascade in memory. Render it section by section to a deferred shadow buffer. That way the memory hit of using even 4096-sized maps will be comparatively low. Fillrate is still an issue, but that ultimately depends on your engine.

2) Use more splits. Six sections are pretty good in my experience. Also, distribute them correctly along depth. I have given up on 'optimal' split algorithms (ie. the ones that try to determine split distances using some kind of metric). The best way, IMO, is through empirical trial'n'error. The visual impact is really subjective and depends a lot on your scenes. But again, good placement can make a whole world of difference.

3) Use some form of non-uniform projection. PSM, LISPSM, TSM, and all their friends. This comes with a whole set of new problems, and can sometimes even worsen the result over a simple uniform projection. But it can also help in some cases.

4) Use some form of filterable or iterative shadow mapping algorithm. This won't solve the problem per-se, but it can hide the effects.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!