Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using MJP's Cascade Shadow Map code and I'm having major issues with the shadows moving with the camera. Here a video to demonstrate what's going on. Also, is there a way to fix the dueling frustum issue? It's annoying seeing them pop in and out of corners of the screen.

Video of the shadows

c# and shader code

share|improve this question
    
+1 for videos. Looks pretty awesome to me, where's the problem? –  ashes999 May 6 '12 at 0:39
1  
If you look at the shadows. You can see them move. When they are suppose to be static. –  Goss May 6 '12 at 1:13

2 Answers 2

up vote 3 down vote accepted

It looks to me like your shadow render is lagging one frame behind the geometry render (or vice versa). I've had this in my own projects before now. Check your update and render order: you may be doing something like:

a) Update world/camera state
b) Draw Geometry
c) Draw shadows
d) Calc shadows with current (i.e. OLD) geom state
share|improve this answer

I'm not familiar with cascade shadow mapping (yet) but that sort of thing seems to happen in simple shadow mapping too, when using wrong parameters in the calculation of the shadow projections.

This should help (with near/far planes too): http://msdn.microsoft.com/en-us/library/windows/desktop/ee416324(v=vs.85).aspx

In your video the shadow edge seems to move bit more than just a 'shimmering' but it could be the result of a really far light source.

share|improve this answer
    
Here an image of the render targets. i.imgur.com/UMfXh.jpg I don't think it's how the near or far planes are being calculated. My far plane is only 400. –  Goss May 6 '12 at 18:29
    
Here the code to MJP's shadow code mynameismjp.wordpress.com/2009/02/17/… –  Goss May 6 '12 at 18:54
    
In the link i posted before there's a part (# 17) where it's suggested to set a lower/upper limit to the calculations, exactly to avoid that 'camera-dependent shadows' effect. Even if it's not when updating the near/far plane, any approximation due to cascade-split switch or shadowcoords calculations could lead to the same pixel having different values depending on the camera position. That's as far as I can help I guess, hope it works for you. –  Darkwings May 8 '12 at 19:24
    
@Goss On MJP's site that you linked to, there's a commenter who posted: "I’ve updated the code to support stable cascaded shadow maps (so that the shadows don’t shimmer when the camera moves or rotates)." Have you tried incorporating that change? –  Nathan Reed Jul 11 '12 at 20:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.