fredator

09-25-2010, 10:31 AM

Hi,

I've been trying to implement ShadowMapping in GLSL using the Tutorial from Fabien Sanglard.

Here is the adress: http://www.fabiensanglard.net/shadowmapping/index.php

This is actually more than one question so I'll enumerate:

1.)

Now I've come to understand, that you need the inverse of the camera view matrix to generate a proper shadow map texture.

But: This Tutorial states that it's unnecessary. So what is it? His example seems to work fine, but he only uses bias, lightview and lightperspective - so shouldn't he be stuck in light space whereas he needs camera space?

I'm confused.

2.)

The other question is: If I need the inverse of the camera viewing matrix, how do I have to rewrite my code, which is very much based on the tutorial.

3.)

What up-Vektor does the lightsource need, when it's positioned above the scene? I used (0,0,-1) because the up-vector mustn't be parallel to the lookAt vector and negative, because positive looked quite wrong.

4.)

I'm experiencing trouble with the shadowed result: It seems like selfshadowing occurs on the dragon model, but I don't understand yet, how to correct that.

I'm including an image to illustrate. Can anyone tell me, what's going on?

I'm still fairly new to OpenGL so it's still a bit hard to understand all the fine print...

I've been trying to implement ShadowMapping in GLSL using the Tutorial from Fabien Sanglard.

Here is the adress: http://www.fabiensanglard.net/shadowmapping/index.php

This is actually more than one question so I'll enumerate:

1.)

Now I've come to understand, that you need the inverse of the camera view matrix to generate a proper shadow map texture.

But: This Tutorial states that it's unnecessary. So what is it? His example seems to work fine, but he only uses bias, lightview and lightperspective - so shouldn't he be stuck in light space whereas he needs camera space?

I'm confused.

2.)

The other question is: If I need the inverse of the camera viewing matrix, how do I have to rewrite my code, which is very much based on the tutorial.

3.)

What up-Vektor does the lightsource need, when it's positioned above the scene? I used (0,0,-1) because the up-vector mustn't be parallel to the lookAt vector and negative, because positive looked quite wrong.

4.)

I'm experiencing trouble with the shadowed result: It seems like selfshadowing occurs on the dragon model, but I don't understand yet, how to correct that.

I'm including an image to illustrate. Can anyone tell me, what's going on?

I'm still fairly new to OpenGL so it's still a bit hard to understand all the fine print...