Proper object transparency

Started by
5 comments, last by Raduprv 19 years, 8 months ago
Ok, this is a stupid question, but what is the way to properly display a semi transparent object? I don't mean the alpha function, or the sorting and such, what mean is, say, I want to draw a sphere, that is supposed to be a light halo around something. The annoying part is that with or without face culling, some faces get in the way, making the the object double in some areas, which give a very nasty effect. So, I was wondering, how do you properly render the object and avoid any double faces getting in the way?
Advertisement
well, i'm using this method with 2 cubes :
- render soild object
- switch on face culling
- tell it to cull clock wise faces
- draw semi-transparent object
- tell it to cull counter-clock wise faces
- draw semi-transparent object

it might not be perfect but it gives decent results i've found, dunno how it would stand up to a sphere however.

(btw, the idea wasnt mine, Yann mentioned it in a thread a while ago)
Umm... how is that different from just disabling face culling?
it properly blends the polys in back to front order (first pass removes front polys, 2nd removes back, more or less) without you having todo it by hand, which whould be faster (although i've not tested in on a scene of any real complexity) and will blend more or less correctly.

Just disabling culling and drawing everything could result in things being blended in the wrong order, say if your object is or view is rotated in any way, as you wont have the correct back-to-front rendering without first sorting the polys.
My order is not important, what I care about is having blending consistency (for example, some unregualted objects, such as a sword) show more than two faces when you rotate them under certain angles, so the glowing is not homogenous.
The closest correct thing I can think of is rendering to a stencil buffer, and then rendering from the stencil buffer once the object has been rendered...
Yes, I was thinking of that too, but not all the cards have an accelerated stencil buffer for 16B resolutions, and besides the stencil buffer is used currently for the shadows...

This topic is closed to new replies.

Advertisement