I've noticed that when rendering 2 partially transparent objects (say alpha 50%) I have to render the more distant one first, otherwise if they overlap the distant object is erased by the near one. I set alpha blending (SRCALPHA INVSRCALPHA) and alpha testing on. Do I have to do something else?
Posted on 2003-11-20 03:35:47 by Vaxon
It's probably due to Z-testing. If you don't disable Z-writing when you render your transparent objects, they will add values to the Z-buffer, resulting in the transparent objects blocking out anything drawn behind them, as if they were opaque.

Note that, if you disable Z-writing when rendering transparent objects (so that transparent objects render properly among the scene geometry without occluding later objects), you need to make sure that all your transparent objects are drawn AFTER all opaque objects; otherwise, an opaque object drawn behind a transparent object will "cover" the transparent object (since it isn't being drawn using any blend operations and the transparent object doesn't exist as far as the Z-buffer is concerned).
Posted on 2003-11-20 05:41:53 by Tatterdemalian
If you use a different opacity than 50%, and you want to draw your objects correctly, you must sort the triangles and draw them back to front.
Posted on 2003-11-20 10:55:09 by gliptic
Thanks a lot:)
Posted on 2003-11-21 02:24:48 by Vaxon