PDA

View Full Version : Shadow Mapping and GL_CLAMP_TO_BORDER



azcoder
09-12-2004, 05:56 AM
Thanks in advance for any help.

Question #1:
I have implemented Shadow Mapping in my game. Historically I have been developing with nvidia hardware. I have recently acquired a new laptop with an ATI Radeon Mobility, and my game has a minor issue with ATI.

It seems that GL_CLAMP_TO_BORDER_ARB is not working for the depth texture. Right now my depth texture represents less than the full visible frustum(for resolution issues - this is an outdoor scene).

The clamping code I am using is roughly:
GLfloat v_bc[] = {1.0f,1.0f,1.0f,1.0f};
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, v_bc);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER_ARB);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER_ARB);

On nvidia, this leaves the non-depth tested portion of the scene out of shadow. ATI appears to ignore the setting.

Even if I render an inverse shadow with glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB,GL_GEQUAL);
ATI appears to ignore the clamp for the depth texture, while nvidia clamps properly.

Any ideas on fixing this?

Question #2:
These issues have also led me to consider implementing shadow mapping with my own glsl vertex and fragment programs. But it appears the GeForce 3 and 4 support the DepthTexture extension but do not support Fragment shaders. In order to provide shadows for GeForce 3 or 4, there would need to be a seperate render path. It does look like all of the ATI cards that support DepthTexture also support Fragment shaders - is this correct?

Question #3:
Trapezoidal Shadow Mapping looks pretty good. Is this the best approach to take to improve the Shadow Map resolution? Does anyone know any sample implementations?

Thanks again for any input...

flamz
09-13-2004, 05:40 AM
The answer to question 1 is : bug in the ATI driver which is resolved (on my FireGL X2) with driver version 6.14.10.6404

azcoder
09-13-2004, 03:52 PM
Thank you for the reply flamz. I am using driver 6.14.10.6467 but I still have the bug.

I have the mobility radeon 9800 Chipset. The problem is ATI doesn't support the mobility chipsets with their drivers. I have to wait for Dell to repackage them.

Do I report the bug to Dell or ATI? Does anyone know how to report the bug?

Thanks