From: Hugues De Keyzer (hugues++at++depinxi.be)
Date: 10/21/2005 08:02:09
Hi all,
I'm trying to clearly understand the various techniques of transparency available in OpenGL (and thus OpenGL Performer).
The most widely used technique is blending, which allows many modes of combining fragments with the blend equation and blend factors. This gives the most beautiful results, but requires polygon sorting to draw them back to front. Intersecting transparent polygons cannot be drawn correctly with this.
Another technique mainly used for drawing complex shapes with few polygons (such as grass and foliage) is alpha testing, which uses the alpha component of a fragment to determine if it should be drawn or not (1 or 0 here, no semi-transparent fragments possible). No polygon sorting is needed here.
Then comes multisampling, where the alpha component of a fragment can be used (when enabling GL_SAMPLE_ALPHA_TO_COVERAGE) to convert it to a stipple pattern (in the worst case). Again, no polygon sorting is needed for this technique.
Now, how can we use these techniques in OpenGL Performer to get the best results?
Working on nVIDIA Quadro FX hardware on GNU/Linux, I played around a bit and made some tests.
pfTransparency with a value of PFTR_MS_ALPHA_MASK is assumed to use multisampling, but it does the same result as PFTR_BLEND_ALPHA. Is this normal? When using glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE) and setting pfTransparency to PFTR_OFF, I'm getting the stipple pattern described above.
Multisampling works only if antialiasing is enabled in the nVIDIA driver (with the __GL_FSAA_MODE environment variable). If antialiasing is disabled, using glEnable(GL_MULTISAMPLE) has no effect, it seems that multisampling is not available. With AA enabled, glDisable(GL_MULTISAMPLE) effectively disables multisampling. Trying to choose different GLX visuals didn't seem to have any effect except weird flickering sometimes. The nVIDIA driver enables several automatic mechanisms (antialiasing and anisotropic filtering) and I suppose it overrides application settings. Is there a way to have a better result than that stipple pattern?
What is pfAntialias for? Does it uses multisampling? When enabling it, it is like blending is turning on, but no antialiasing takes place.
On our Onyx2, we had nice order-independent transparency. I suppose it was using multisampling for this, or was there another mechanism? Is it possible to acheive the same results on PC hardware or were there special hardware combining buffers?
Regards,
Hugues De Keyzer
de pinxi
This archive was generated by hypermail 2b29 : Fri Oct 21 2005 - 08:12:27 PDT