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:
|
No alpha test. Click to enlarge. |
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à...
|
Alpha test. Click to enlarge. |
The model, "
herbe01.obj" is in the
./tools/wavefront directory in the GLOBE_3D repository.
GLOBE_3D is a GL Object Based 3D engine realized with the Ada programming language.
URL:
http://globe3d.sf.net/