• Advertisement
Sign in to follow this  

Large terrain shadows

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

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.


For now the heightfield is generated by a background thread while the player moves... But that does not seem to be a so good idea.


Thank you for your help, I will take a closer look at Wolfire terrain technique.

Share this post


Link to post
Share on other sites
The problem with Wolfire (and overgrowth's) shadows is that they're completely static. They look good for a static sun position, but if you want any time of day changes then that's out.

Further, I wouldn't go with an interval update for shadow maps. Skyrim does that, and it can be even more distracting than a bit of shimmer you'd otherwise get. Honestly, depending on your target hardware and other factors you could just brute force it. Sample distribution shadow maps http://visual-computing.intel-research.net/art/publications/sdsm/ with say a triple 2k split might look good enough, especially since the biggest artifacts you're getting are from aliasing.

Share this post


Link to post
Share on other sites
The problem with Wolfire (and overgrowth's) shadows is that they're completely static.[/quote]
Well depending on the game he 1: may not need time of day. 2: you can still change the sun vector on the height map on the cpu and resend a nice light map right down to the gfx card. Just thread it or something and when it is done computing you can send it back down. Your sun will only move 1 time every 20 seconds to a minute depending on the game. So why re-draw it every frame? You also get to filter your light map to get softer edges.

Share this post


Link to post
Share on other sites

The problem with Wolfire (and overgrowth's) shadows is that they're completely static.

Well depending on the game he 1: may not need time of day. 2: you can still change the sun vector on the height map on the cpu and resend a nice light map right down to the gfx card. Just thread it or something and when it is done computing you can send it back down. Your sun will only move 1 time every 20 seconds to a minute depending on the game. So why re-draw it every frame? You also get to filter your light map to get softer edges.
[/quote]

Actually, I need to handle time of day. I wonder if i will not do some kind of horizon mapping, storing 2 angles for each point of the map. The first angle indicating when the sun will start to illuminate the point, the second when it will end to illuminate. I could store AO in the map too. This could be pretty fast. In addition, I will use CSM for the closer objects.


Do you think it's ok ?

Cheers !

Share this post


Link to post
Share on other sites

The problem with Wolfire (and overgrowth's) shadows is that they're completely static. They look good for a static sun position, but if you want any time of day changes then that's out.

Further, I wouldn't go with an interval update for shadow maps. Skyrim does that, and it can be even more distracting than a bit of shimmer you'd otherwise get. Honestly, depending on your target hardware and other factors you could just brute force it. Sample distribution shadow maps http://visual-comput...lications/sdsm/ with say a triple 2k split might look good enough, especially since the biggest artifacts you're getting are from aliasing.


You're right Skyrim's shadows are really awful :) Thank you for you paper I will take a look at it !


Cheers !

Share this post


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

  • Advertisement