Hello there I have some troubles when doing deferred shadow mapping, I have tried so many different aproches and this is the best I can get (using this http :// data.redplant. de/webgl/deferred/spot/), nevertheless still not good enought. And as this is getting really depresing I am coming here asking for some help. I have here all the breaking down of what I am doing and a picture with the final result. I would be so greatfully if someone could give me a hand with this as I am really stragling.Hello there I have some troubles when doing deferred shadow mapping, I have tried so many different approaches and this is the best I can get, nevertheless still not good enought. And as this is getting really depressing I am coming here asking for some help. Here is all the code related to what I am doing and a picture with the final result. I would be so gratefully if someone could give me a hand with this as I am really struggling.

This is the wrong order. Don’t get confused by the order of words in [model-]view-projection matrix. The correct order of matrices to calculate a final transformation matrix T = M_Proj * M_View [* M_Model].

With T, you express a transformation from object- to world- (if any), then from world- to eye- and finally, from eye- to clip-space.

Other than that, your shader seems ok at first sight.

This is the wrong order. Don’t get confused by the order of words in [model-]view-projection matrix. The correct order of matrices to calculate a final transformation matrix T = M_Proj * M_View [* M_Model].

With T, you express a transformation from object- to world- (if any), then from world- to eye- and finally, from eye- to clip-space.

Other than that, your shader seems ok at first sight.[/QUOTE]

Sorry thokra, I copy and paste in the wrong order… that was my mistake, nevertheless yeah I do have:

First: MVP = Projection * ModelView;
then I do for every object in the scene: MVP * ModelMatrix which I pass to the shader…

So the funny thing is, I have tried lot of different ways and I can not find where the mistake is, I have compared line by line with other approaches like:

I can’t see anything either atm. What I do see is that the arcs are being rendered, the pillars, however, are not. Can you post a screenshot of your depth buffer?

In any case, when dealing with shadow mapping, always check your depth buffer for correctness. If you’ve got nonsense in there, even the coolest algorithm won’t give you plausible results.

Hey thokra, Thank you for your quick answer, I have made a screenshot where you can see the pillars too, also to mention that the shadow moves when you move the camera which I think it shouldn’t do. Here is the link for that. https://www.dropbox.com/s/rl1jd9kiv5dcuxb/shadow_compare.jpg

Here is the depth buffer from the camera (left) and from the light source (right), also I have tweak the levels in photoshop to make it more visible (which are the bottom ones). https://www.dropbox.com/s/7uv2xwd3zhdk3kn/depth.jpg