I have implemented my first shadow effect using projective texture mapping. I wondered how to eliminate the reverse projection. Now i’m using clip planes to draw only the positive geometry, but i think this is not a good idea because sometime the clip plane doesn’t gave the correct result. The NVIDIA paper says that it can be solved using 1D texture map, but how does it work?
I also do that for the projected spotlight texture.
There are a lot of other methods though. Besides the 1D texture one, you can even use a clip plane to clip everything behind the light (assuming you’re using a spotlight). I also seem to remember something about calculating a vertex spotlight and multiplying that result with your per pixel lighting w/ shadow map result. I’ve never tried that though. I just use my Cg shader method from above.
thanks for your informations about the CG method.
But unfortunatly, I can not use any fragment shader on my hardware, so I really need to know more about the 1D texture map method.
Tell me everything you have concerning this method.
I attempted to implement the ARB_fragment_program solution that was mentioned above. I haven’t yet been able to work with the case where q < 0, because the fragment program without such a condition seems to prevent the projected texture from being displayed.
Here is the fragment program:
ATTRIB tex = fragment.texcoord;
ATTRIB col = fragment.color.primary;
if q is negative, kill fragment
OUTPUT outColor = result.color;
TXP tmp, tex, texture, 2D;
MUL outColor, tmp, col;
Is the TXP line not suitable when rendering with a projected texture?