Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

Cascaded Shadow Map Impl

Started by vetroXL Mar 7, 2009 at 8:17 AM 5 replies 2.5k views
Original Post
vetroXL
vetroXL
Hi, I can't seem to figure out what to do about a problem with my cascaded shadow map implementation. I have some screen shots below. I get some artefacts when transitioning from one cascade to another. I think it gets confused. I tried various depth bias and slope depth bias values but the artefacts remain. I have two splits, and I transform the current vertex position with the camera view and compare the z value with an array of far distances from the split. Is there a bug in my implementation? Any help would greatly be appreciated image with artefact image without artefact, same position just camera is rotated [EDIT: Forgot to put title]
FeverGames
FeverGames
i think it would be very helpfull if you would post your used shader code(s)
vetroXL
vetroXL
Ok,

First of all I would like to make sure I have the concept right. Here's the way I have implemented. If there are any mistakes I would greatly appreciate a clarifiation;

1. Split the camera frustum up into n sub-frusta
2. transform each sub-frusta into the light view space and find a bounding box for each sub-frusta.
3. render a separate shadow map for each split-frusta from the lights point of view.
4. render the scene by choosing the right shadow-map according to the vertex distance.
MJP
MJP
Well you definitely have the basic concept right. Which means you probably just have a small glitch in your code somewhere. And yes, CSM's are good for large dynamic scenes since they optimize your shadowmap texel distribution for long viewing distances.
vetroXL
vetroXL
Thanks MJP,

At least now I can focus on debugging the implementation instead of wondering if I got the concept right or not. I think i may know where my bug is... I am using the new DirectX10 SV_RenderTargetArrayIndex feature to render the cascasdes in parallel and using geometry cloning with the correct LightViewProj matrix... I think I have also have to use SV_ViewportArrayIndex to tell it what view port to use... it looks like my implementation is writting over the prviouse split.... so I can adjust the viewports minz and maxz accordingly. I really hope this is it since I have been working on this issue for nearly a month now...

vetroXL
vetroXL
Anyways, it wasn't a bug it was just alot of tweaking involved with the near/far plane parameters to get a set that fit the scene. I ended up implementing PSSM and all the artefacts were elimanated with zero tweaking it just worked... I have put some more detail on my journal if anyone's interested.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.