Jump to content
  • Advertisement
Sign in to follow this  
doomtr666

Large terrain shadows

This topic is 2385 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

Hi,

I've a large terrain to render, and I try to cast shadows on it. (you could see a video here showing the rendering without shadows). I've tried various techniques : PCF, VSM with blurring and a basic version of CSM (atlas). I still have visual artifacts even with a large (4096) shadow map and poor performance with CSM.

Here is a screenshot of my actual results.:

[attachment=6015:BadShadows.jpg]


I had a look at offline shadow (and OA) techniques, but my terrain is procedurally generated on-the-fly and I'm not sure it's possible to compute that in real-time.

What can I do to improve shadow quality and performance ?

Thanks !

Share this post


Link to post
Share on other sites
Advertisement
Hi,

CSM should give you rather sharp shadows with good splitting ranges. Of course, increasing the amount of splits makes CSM slower and slower.

Currently I am using semi-static shadow map (update rarely) + 2 split CSM (update every frame). So I get sharp dynamic shadows at close range and blurrier static shadows at distance. The problem I am facing though is that continuously changing terrain lod causes anomalies with the static shadow map.

Cheers!

Share this post


Link to post
Share on other sites
Hi,





Currently I am using semi-static shadow map (update rarely) + 2 split CSM (update every frame).




So you mean you use a semi static shadow map for terrain self shadowing, and 2 split CSM for other objects ?


What technique did you use for the static shadow map ?

Cheers !

Share this post


Link to post
Share on other sites

Hi,

[quote name='kauna' timestamp='1320757265' post='4881750']
Currently I am using semi-static shadow map (update rarely) + 2 split CSM (update every frame).



So you mean you use a semi static shadow map for terrain self shadowing, and 2 split CSM for other objects ?


What technique did you use for the static shadow map ?

Cheers !
[/quote]

Hi,

I'm not saying that my technique is the best but it has some point in it. The CSM part covers only like 0-200 meters of the scene with 2 splits. Everything is rendered into these maps. The distance 200+ is in the semi-static shadow map. Everything except moving objects are rendered into this shadow map. This semi-static shadow map is nothing else than a simple high-res projected shadow map as shown in many shadowing examples.


I tried to render everything with 4-part CSM but the performance was rather horrible and I found it rather difficult to adjust the splits correctly for huge scene. There are lots of ways to improve the performance such as aggressive and exact culling of shadowing objects and using low-res models for shadowing.

Cheers!

Share this post


Link to post
Share on other sites

Thank you for your tips ! I will make more tries with CSM / static shadow maps.


Cheers !




How many splits are you using in your CSM? What res maps and where is the bottleneck occurring that's slowing it down?

-Si

Share this post


Link to post
Share on other sites
First, the artifacts on the top can be reduced if you check the actual Dot(Normal,Light). If this is negative, then you should set your pixel to = the same value as your shadow map. Because sometimes at the top of a curve you get what you have where its actually facing away from the sun, but because of the texture it doesn't quite hit.

Other than that the bottom looks fine to me. The best method of terrain I have seen though is to bake it into a 2048x2048 light map. If your terrain is super huge then do megatexturing, or LOD a grid of patches and use higher resolution textures on the closest terrain.

Share this post


Link to post
Share on other sites


How many splits are you using in your CSM? What res maps and where is the bottleneck occurring that's slowing it down?

-Si
[/quote]
Si,


I've tried with 3 splits packed in a 2048x2048 texture, each splits overlapping. The bottleneck seems to be the number of processed triangles, there's no LOD algorithm for now.

Share this post


Link to post
Share on other sites

First, the artifacts on the top can be reduced if you check the actual Dot(Normal,Light). If this is negative, then you should set your pixel to = the same value as your shadow map. Because sometimes at the top of a curve you get what you have where its actually facing away from the sun, but because of the texture it doesn't quite hit.

Other than that the bottom looks fine to me. The best method of terrain I have seen though is to bake it into a 2048x2048 light map. If your terrain is super huge then do megatexturing, or LOD a grid of patches and use higher resolution textures on the closest terrain.


dpadam,


Thank you for the dot product trick, I'll try that !

For now the terrain is procedurally generated on the fly, so I'm unsure that it possible to bake the light map in real time ?

Share this post


Link to post
Share on other sites
For now the terrain is procedurally generated on the fly, so I'm unsure that it possible to bake the light map in real time ?[/quote]
What do you mean on the fly? At startup or does it change at run time by dynamic destruction? If its at startup then generate 1 height map, regardless of LOD method, you still have it project to the correct spots that the original shadow map should be just fine. I have this same problem myself, well did because its not that great for terrains in my opinion: Look up Wolfire on youtube, their terrain is beautiful, uses a 2048 static shadow map and texture splat map. Also saves you a little bit of render time to not re-draw the terrain 2 times every frame.

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!