This is not related to shaders at all. What you need is a good tutorial on shadow mapping and there are plenty on the net, just google.
What you need at this point, as far as I can remember is to compare the two textures, use the ARB_shadow extension (and surely another one) for that purpose. Just check the extension registry if the tutorial you’ll find doesn’t talk about that.
Also, I advice you first do the shadow mapping without using shaders at all. Then, when they’ll work, try the shader.
Originally posted by jide:
[b]This is not related to shaders at all. What you need is a good tutorial on shadow mapping and there are plenty on the net, just google.
What you need at this point, as far as I can remember is to compare the two textures, use the ARB_shadow extension (and surely another one) for that purpose. Just check the extension registry if the tutorial you’ll find doesn’t talk about that.
Also, I advice you first do the shadow mapping without using shaders at all. Then, when they’ll work, try the shader.[/b]
I prefer using shaders. Plus it would be a good exercise to do
To my knowledge I need to do:
lightProjection * LightView * InvCamView
to project the texture. But I’m not 100% sure about this. Is this correct?
Now in GLSL, I know there is the function:
Texture2dProj or textureRectProj,
which should project the texture but how do I use this functions?
Thanks for your answer.
Ps. If anyone knows a tutorial of shadow mapping using glsl let me know. the only one I can google is:
the Scale/Translation has to be done to map from NDC [-1,1] into your texture UV space [0,1].
You can use this Matrix then to do the correct texture2Dproj lookup in your GLSL fragment shader.
It should return 0 if the fragment is in shadow and 1 if it´s lit.
the Scale/Translation has to be done to map from NDC [-1,1] into your texture UV space [0,1].
You can use this Matrix then to do the correct texture2Dproj lookup in your GLSL fragment shader.
It should return 0 if the fragment is in shadow and 1 if it´s lit.[/b]
Thanks but…
What do you mean by lightintrinsic and lightextrinsic?
the <lightintrinsic> means the gluPerspective(fov, aspect, near, far) [or the according glFrustum()]values. You have to use the same ones you used when you captured the shadowmap.
the <lightextrinsic> are the 9 gluLookAt values which describes your light source pos,dir and upvector.
if you don´t use gluLookAt() you have to use the view transformation you used for your shadowmap generation…