PDA

View Full Version : Error in projected textures (good topic, sorry for the other 2)



KRONOS
09-28-2004, 05:57 PM
First, sorry for the triple post! The forum crashs because it can't accept the OR symbol, making me unregistered after posting the message! And then can't delete and there is was no moderator around to solve the problem... :(

Here is the problem:

I implemented projected textures and I got this:
http://sigma.gamedev-pt.net/transfer/erro2.jpg
http://sigma.gamedev-pt.net/transfer/erro3.jpg
http://sigma.gamedev-pt.net/transfer/erro1.jpg

The problem is the line of projected texture seen on the right on the pictures. The last picture shows better the ambient where the light is being projected.

I use the next code to generate the texture coordinates (in the vertex shader):

texCoordProj=(gl_TextureMatrix[0]*gl_Vertex).xyw;Then in the pixel shader:


if (texCoordProj.z<=0.0) discard;
proj = texture2DProj(texProjection,texCoordProj);The texCoordProj.z<=0.0 gets rid of the backprojection, but that line is always there. Even without texCoordProj.z<=0.0, with the texture being back projected, it still makes that line. I think it may have something to do with the light's frustum because the line seems parallel to the near clipping plane of the lights frustum... But why?

jwatte
09-28-2004, 07:12 PM
Maybe your shadow map is filtering against the border? Have you tried setting GL_CLAMP_TO_EDGE wrapping mode?

unreal
09-28-2004, 09:50 PM
i cannot understamd what part of the projected texture this line is. but when i had an other problem with projective texture i use GL_CLAMP_TO_BORDER and i finaly fix this.

KRONOS
09-29-2004, 02:01 AM
OK, thanks... Fixed it! :D

I was already using GL_CLAMP_TO_EDGE, but using GL_CLAMP_TO_BORDER solves the problem, even tought I create the textures with border 0. :confused:

Tom Nuydens
09-29-2004, 03:04 AM
If your texture is specified without a border, GL_CLAMP_TO_BORDER uses a constant color instead. You can change this color by setting GL_TEXTURE_BORDER_COLOR with glTexParameter*().

-- Tom