PDA

View Full Version : Projective Shadow Has Black Boxes Everywhere



soconne
11-02-2003, 05:58 AM
I'm trying to do projective shadowing and I'm getting the following issue. http://cs.selu.edu/~soconnell/projshadow.JPG

I don't understand why I'm seeing those black boxes then semi-black boxes on the screen. I set the bodercolor of the texture to white but they're still there, and I have clamping on also. Here's my code for updating the shadow texture:

glBindTexture(GL_TEXTURE_2D, depthtexture);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, TSIZE, TSIZE, 0);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
float bcolor[]={1,1,1,1};
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, bcolor);


Would the problem perhaps be somewhere in this code?

soconne
11-02-2003, 03:31 PM
Well I tried changing the last paramter of glCopyTexImage2D, which is the border parameter, to 1 since I am setting the border color for the texture. But after doing that, now the shadow texture is blank, I don't get any shadows. Any ideas on this?

soconne
11-02-2003, 04:21 PM
Now I set the GL_CLAMP to GL_CLAMP_TO_BORDER and set the border color to {1,1,1,1} and those stretched black lines are gone, but now the image consists of basically 4 squares, 1 white and 3 black looking like this
---------
| *****
| *****
*********
*********

I hope that makes sense, basically the open area is the light's point of view and where the objects are rendered using black color. But the rest of that square, to the right, left and behind the light are rendered as black for some reason. I've looked up GL_CLAMP in the forums and a lot of people have had problems with this and said use GL_CLAMP_TO_BORDER but this isn't working in this situation.

soconne
11-02-2003, 04:30 PM
here's a pic of what it looks like now.
http://cs.selu.edu/~soconnell/projshadow2.JPG

and i'm using a radeon 9800 pro, so it's definitely not an OpenGL < 1.2 issue....I think

soconne
11-02-2003, 06:28 PM
I hope nobody think i'm crazy for posting so many times on my own question, don't bash me or anything.....cough cough Korval.....

but I found out that if i make the shadowmap resolution 512x512, instead of 1024x1024 like I've been doing, I don't get that black box. why the heck does it do this?

Adrian
11-02-2003, 07:51 PM
If you run it with a screen resolution of 1280x1024 and a shadow map res of 1kx1k, do you still get the black boxes?

CatAtWork
11-02-2003, 08:03 PM
If you're not using pbuffers to render the depth texture, you can't have the texture larger than your viewport.

soconne
11-03-2003, 03:15 AM
Ah yes, you guys are right. I changed the viewport and it works fine. Thanks alot.