Z-fighting of shadow volumes on ATI 9600
So, I've been developing my game on a powerbook with an NVIDIA 5200 Go card. My stuff looks good, there. I've tested recently, against a GF4MX and a G5 with an ATI 9600.
Well, the ATI shows *significant* z-fighting in the shadow volumes. here's a pic, which will be followed by an explanation of my setup:
So, I'm using z-fail shadows, which require that the shadow volume be capped at front and back. Easy enough! But, the front caps have to be pushed a little away from the camera so as not to cause z-fighting with the front-facing occluder geometry. Again, easy enough! I thought.
Here's the relvant code:
This works *fine* on an NVIDIA 5200 and GF4MX. But not on the ATI. Can anybody tell me what I'm screwing up here? This ought to be simple.
Well, the ATI shows *significant* z-fighting in the shadow volumes. here's a pic, which will be followed by an explanation of my setup:
![[Image: z-fightin.jpg]](http://home.earthlink.net/~zakariya/files/Legion/z-fightin.jpg)
So, I'm using z-fail shadows, which require that the shadow volume be capped at front and back. Easy enough! But, the front caps have to be pushed a little away from the camera so as not to cause z-fighting with the front-facing occluder geometry. Again, easy enough! I thought.
Here's the relvant code:
Code:
void Geometry::drawShadowVolumeImmediate( void )
{
vec3 point;
glBegin( GL_QUADS );
for ( int i = 0; i < _shadowVolumeTop; i++ )
{
point = _shadowVolumePoints[i];
glVertex3f( point.x, point.y, point.z );
}
glEnd();
/*
Caps need to be pushed *backwards* in depth buffer so
as to eliminate z-fighting with occluder geometry
*/
glEnable( GL_POLYGON_OFFSET_FILL );
glPolygonOffset( 1.0, 1.0 );
glBegin( GL_TRIANGLES );
for ( int i = 0; i < _shadowCapTop; i++ )
{
point = _shadowCapPoints[i];
glVertex3f( point.x, point.y, point.z );
}
glEnd();
glDisable( GL_POLYGON_OFFSET_FILL );
}
This works *fine* on an NVIDIA 5200 and GF4MX. But not on the ATI. Can anybody tell me what I'm screwing up here? This ought to be simple.
I can honestly say that I know very little about the parameters to glPolygonOffset, but 1 and 1 seem a bit low. Also, I suppose that is what it breaking, since the actual equations used by glPolygonOffset is implementation-dependent. Check the man page, and then set both to 10 just to try it out.
I'm going to give this a shot. Problem is, I don't have direct access to the machine -- it's a work machine, and it's hard to find time when I'm at work and I can test my sideproject

I figured it out! But I haven't fixed it yet... one of those walking-home-from-work eureka moments. It turns out I'm not correctly binding a fragment program which mimics the functionality of GL_NV_DEPTH_CLAMP correctly. It explains the results...
Has *nothing* to do with what I thought the problem was.
Has *nothing* to do with what I thought the problem was.
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
2d shadow blending problems | tesil | 1 | 7,733 |
Mar 17, 2011 10:12 AM Last Post: Skorche |
|
Replacing edges with degenerate quads (for shadow volumes) | Coyote | 9 | 13,096 |
Jan 15, 2010 07:08 PM Last Post: Coyote |
|
Shadow Mapping - Self-Shadowing Z-Fighting Artifacts | Bachus | 16 | 34,497 |
Feb 11, 2009 12:24 PM Last Post: arekkusu |
|
Occlusion query code failing on ATI 9600 | TomorrowPlusX | 4 | 7,971 |
Mar 10, 2007 08:52 AM Last Post: arekkusu |
|
GPU shadow volume extrusion with GLSL | TomorrowPlusX | 12 | 19,611 |
Jan 24, 2007 03:21 PM Last Post: JoNo21 |