Been working on getting basic shadow projection mapping working. The results so far have been good. It works great on my GF2, but my Radeon9800 exhibits issues with clamping the shadow texture to stop it repeating.
You can see the bug here http://www.noisecrime.com/temp/radeonbug.jpg
What i’ve done is add a spotlight texture mask in the camera that renders the light POV. This means the edges of the texture should all be black. But no matter what I try on the Radeon outside the texture area is not black but grey.
I’ve tried using CL_CLAMP, GL_CLAMP_EDGE, and numerous other things with no success. I was wondering about GL_BORDER, but not sure how to set that up correctly.
If I remove the spotlight mask, so the edges of the texture are white, then all is well, and whilst I imagine this is how i’d used Shaodw mapping most of the time, i’d still like to be able to do the spotlight effect.
Was wondering if there is something i’m missing?
I would also like to be able to blur the shadow texture before its rendered but unsure how to go about this. Let me explain.
I set up the shadow scene (white background, black models), and place the camera at the POV of the light. I render this into the viewport. I then do
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, tWidth, tWidth, 0);
to place the rendered shadow view into a texture without mipmapping.
After which I clear the viewport and render the real scene, where I use mutli-texturing to apply the shadow texture over the scenery models.
So I’d like to somehow blur the openGL shadow texture but i’m not sure of the best approach. I doubt using openGL’s pixel functions are a good idea, but can’t think of anything else. I’d appricate some ideas.