PDA

View Full Version : projected shadows



Bruno
04-05-2003, 01:11 PM
I have implemented projected shadow maps in my engine, and it's working great, but , i have a problem with it.

Please take a look at this shots :

projectfy.fysoftware.com/problems/

As you can see, in some shots the shadows are correct, while in other's they are a mess.
On the upper-left corner you can see the projected texture that is generated from the light point of view.
When the shadows are correct, you can see the black mesh all inside of the blue quad, when i get weird shadows, you can see that the black mesh is not completely inside the blue quad.
I only get this weird artifacts when the meshe is out of the light fustrum , when this happends Texgen automatically clamps the texture on the surface.
The way i was able to fix this, is keep updating the light direction, to point allways into that mesh, but this will also be a problem if there are two meshes in the same room., if that happens the only way i see to fix it is to have more than one rendering pass, wich i'm tryng to avoid badly.

Have anyone had this problem ?
Any ideias, on how to fix this ?


thanks,
Bruno

tellaman
04-05-2003, 01:22 PM
i gues you're suffering from what cass in his paper defines as reverse projection
give a look at http://developer.nvidia.com/docs/IO/1317/ATT/projective_texture_mapping.pdf

but one thing i do not understand, why should your subject fall outside the blue quad, i mean projective shadowing implies some directional spotlight
from what i can see, it looks like you're trying to use a directional light as if it was a point light

Bruno
04-05-2003, 01:39 PM
Naaa., i already read that paper, i don't think this is that problem, reverse projection should only appear in the back of the light, and those artifacts are not in the back of the light.
Projection shadowing indeed assumes that the light is a spotlight, and that's what i want, but it seems that this is only working when the object being lighted is entirely inside the light fustrum, if even a little bit is outside i get this mess..
It has to be a fix to this

tellaman
04-05-2003, 01:53 PM
yes i do agree but think about it: how should shadows appear for objects outside the light frustum? in the shots you've posted also parts of some walls should be completely darkened out since they are as well outside light frustum
i still think you should go for point lights, i.e. stencil shadow volumes

[This message has been edited by tellaman (edited 04-05-2003).]

Bruno
04-05-2003, 02:04 PM
I agree with you too http://www.opengl.org/discussion_boards/ubb/smile.gif
shadows outside the light fustrum should not appear, if the light cannot see them, so, they cannot cast a shadow too.
What i don't want is if a mesh falls outside the fustrum to render those weird artifacts.
As i understand CLAMP stretches the texture along the face axis, so that's what it's doing here, the black mesh is on the edge of the texture, and CLAMP streches it.
Having a white border on the texture should fix this, but it isn't.

tellaman
04-05-2003, 02:22 PM
then why dont you draw a white border on your shadow texture, there are many ways you can do that, even in a single pass

dorbie
04-05-2003, 03:16 PM
The problem is clamping of the texture, not back projection, as you've discovered. I wouldn't place a white border though. It's not the shadows outside the light 'frustum' that shouldn't appear, it's the *light* that shouldn't appear. So everything outside the frustum should be in shadow for that light, that means a black border, or you could make it a nice circular border with any kind of cool looking attenuation pattern, just add it to the shadow texture rendering code. It really depends on whether you are going with correct lighting (additive along the lines of Carmack's Doom3) or a quick hack for visual impact as to the approach you take.

[This message has been edited by dorbie (edited 04-05-2003).]