Menu

Non-convex objects with transparency

It's stunning how the inventors of GL addressed from the beginning, in 1991, subtle issues popping up when displaying 3D object in your own program 25 years later.
For instance, take this model:

It is a cross shaped (considered from above) object; texture has lots of transparency.
In the red rectangle you see the issue: the face in front was displayed before the face behind.
There is no bullet-proof rule for sorting faces, and GL has a per-screen-pixel depth buffer that allows displaying faces in an arbitrary order. So we don't want to introduce imperfect face sorting just for dealing with this kind of object.
Fortunately, the GL geniuses have invented a solution for that issue too:

    Enable    (ALPHA_TEST);
    AlphaFunc (GREATER, 0.05);

Et voilà...

The model, "herbe01.obj" is in the ./tools/wavefront directory in the GLOBE_3D repository.

Posted by Gautier de Montmollin 2016-07-03

Log in to post a comment.