PDA

View Full Version : polygonOffset and depthMask



podjo
03-03-2005, 11:30 PM
In my X-plane plugin, I need to use depth testing ALL the time. I do not depth sort my polygons as that would be too expensive and that is why there is a depth buffer in the first place!

Some polygons that I draw cause Z-buffer flickering since they are co-planar or almost co-planar but do not share vertices.

To overcome this I added polygonOffset. This overcomes the Z-buffer flickering. However, it seems that the Z-offsets generated are not only added for the depth TEST but are also added to the value WRITTEN to the depth buffer. Thus I get problems with later polygons.

The quesion is: is there a way to apply polygonOffset for depth testing BUT disable the addition of the polygonOffset contribution to the value written to the depth buffer ?

Excuse me if this topic has been handled before but I have search the forum without finding the answer.

Thanks in advance, podjo.

Stephen_H
03-04-2005, 01:21 PM
The quesion is: is there a way to apply polygonOffset for depth testing BUT disable the addition of the polygonOffset contribution to the value written to the depth buffer ? Use a fragment program and do your own depth offseting and testing.