How do I get rid of this alpha transparency artifacting with classic fixed function OpenGL?

I tried all kinds of settings but I'm not sure why it's good in the upper half of the mask but not in the lower half.

alpha illustration | 1.7M GIF

I have a two-sided concave mesh and want to fade out the edges with an alpha vector on the vertex colors. I get the same artifact with an RGBA texture also.

  • \$\begingroup\$ creepy .gif >.< \$\endgroup\$ Feb 18, 2011 at 17:16

1 Answer 1


You can't do this in a single pass.

Well, maybe I should clarify.

If you look at the way a triangle rasterizer works, is that it takes a bunch of triangles and puts them on the screen. But, for each pixel, it checks its z value to a value in the z-buffer. If the z of the pixel that wants to be drawn is greater than the pixel that was already there, the z in the z-buffer is set to that value and the pixel on the screen is set to that pixel.

However, you might be able to work around this, like so:


// render polygons


Now you read from the z-buffer, but you don't write to it. This way, every pixel is drawn regardless of depth. However, this probably won't work for you. It will mean that some background triangles will be rendered on top of foreground triangles.

What you want to do is split the rendering into two passes: a normal pass and a pass for alpha-transparent polygons. When you render the second batch, you can look up the color of the pixel behind the one you're drawing and alpha blend with it.

  • \$\begingroup\$ Interesting. I’m a bit contrained in my setup because the morphing that you can see is done by a function that uses vertex shaders to do quick morphing. I can tell this thing to give the a render to FB or display list, but otherwise I’m not sure how I would break it up into two passes. \$\endgroup\$
    – towolf
    Feb 18, 2011 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .