Hi,
I’m trying to produce a transparent world … land masses solid and seas semi-transparent. I want to be able to see the reverse land masses through the sphere so I disable GL_CULL_FACE.
Now, it works … but it generates transparent artifacts that are not related to lighting but are related to the view angle of the object.
This is “z-fighting” : 2 pieces of geometry fighting for the same Z distance.
Solutions :
increase zbuffer precison : go from 16 to 24 bits, bring near projection plane farther (never at 0 !), bring far projection plane nearer
make your geometry better, ie specify the exact same coordinates for both land masses and seas, so depending on your depth test, the last one will show.
in your case it seems that both “spheres” were not tesselated the same way, maybe do something about it ?
Yes … that’s what I thought at first and you’re correct, the shape of the artifacts do relate to the actual mesh.
In the end, I found that rendering it in two passes fixed the problem completely … first pass with glCullFace(GL_FRONT) and then glCullFace(GL_BACK).
Not actually certain as to whether this might possibly be a limitation of my graphics card / driver (NVidia GForce 2) - especially as I can reproduce the same problem in a commercial 3D explorer application. I am fairly certain that it’s not z-fighting as the problem does not appear to be effected by the geometrical size of the sphere nor z-buffer depth etc.