PDA

View Full Version : Projected shadows z-fighting on ATI cards only



halo
08-09-2006, 02:27 AM
I have users experiencing z-fighting with my multipass lights and shadows, on ATI cards only.

-glDepthMask is set to False.
-glDepthFunc is set to GL_LEQUAL
-glPolygonOffset is set to -1.0,-1.0
-GL_POLYGON_OFFSET_FILL is enabled

I can't reproduce this on an NVidia card, so I have no idea what is wrong.

http://members.cox.net/rodburns/enginestrange.jpg

http://www.moon-design.com/shadows.jpg

Relic
08-09-2006, 03:59 AM
16 vs. 24 bit depth buffers?
Try higher polygon offset values.

Humus
08-09-2006, 12:16 PM
Are you using clip-planes and mixing with any pass not using clip-planes (for instance ambient pass)? If so, then you'll indeed get z-fighting due to the clip-plane implementation creating new geometry and you'll need a depth bias for that pass.

k_szczech
08-09-2006, 12:17 PM
Try not using polygon offset and draw polygons exactly in the same place in all passes. If you pass exactly the same vertex coordinates in second pass you should get exactly the same fragment depths.
This is true for stencil shadows or shadowmaps when you draw the same geometry multiple times. If you just render shadows as polygons placed on walls then you do need polygon offset.