Artifacts/Bleed thourhg when rendering parallel polys

I have a scene that is begin rendered by 2 programs. Program A (someone elses that I dont have access to) and Program B (my source).

In the scene there are a few places that have papers lying on a desk. The polys are of the paper and the desk are parallel, and very close tobeing on the same plane. When program B renders the scene I get a tearing effect as though the polys are intersecting and not parallel, and the tearing changes as the camera moves. Program B renders the papers correctly obscuring the desk.

What can I do to get my source rending correctly?

GL_DEPTH_TEST is enabled.
The problem exists if I render front to back or back to front.
If I move the papers slighty farther away the problem goes away.

Offset the paper from the table. This can be done manually, or by setting the polygon offset value after drawing the table and before drawing the paper.

Another idea is to try and “squeeze” your depth range… instead of going from 0.1 to 1 billion, go from 1 to 100 (or whatever the smallest range is that you can possibly use). This will give fewer depth artifacts.


Also look into glPolygonOffset

Not sure how i would go about “sqeezing” my depth range. Do you yea mean by modifying glDepthRange to some thing other that 0,1 ?
Tried that no effect.

While the polygon offset will probably work, it will require knowning what polys are going to cause this problem, Which i would rather ot have to deal with.

Would adjusting the size of the Zbuffer help ? (alsthough im not sure how to get it to happen, as no matter how many bits i request I always get 16)

Actually, he was talking about the ratio between the near and far clipping planes specified by the projection call (ie glOrtho, glFrustum, gluPerspective, etc). If the ratio far/near is too great your depth precision is reduced (ie objects several units apart may be considered by OpenGL to be at the same depth).

Either try that, a manual offset or use glPolygonOffset, or a combination. I think those are probably your only choices.

Ahh ok…well my near/far are 1.0/8000 right now cant go much smaller than that (

I suggest you at least try

glPolygonOffset(1.0f, 1.0f);// also try (0.0f, 1.0f) - it might look better - I dunno

draw paper


and see how it looks. No harm in trying. And do not call them between glBegin and glEnd.