Large terrain shadows

Started by
13 comments, last by doomtr666 12 years, 5 months ago
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 !

----

www.winthatwar.com

Download our latest demo here.

www.insaneunity.com

@InsaneUnity

@DTR666

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!
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 !

----

www.winthatwar.com

Download our latest demo here.

www.insaneunity.com

@InsaneUnity

@DTR666


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!
Thank you for your tips ! I will make more tries with CSM / static shadow maps.





Cheers !

----

www.winthatwar.com

Download our latest demo here.

www.insaneunity.com

@InsaneUnity

@DTR666


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
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.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal



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.

----

www.winthatwar.com

Download our latest demo here.

www.insaneunity.com

@InsaneUnity

@DTR666


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 ?

----

www.winthatwar.com

Download our latest demo here.

www.insaneunity.com

@InsaneUnity

@DTR666

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.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

This topic is closed to new replies.

Advertisement