• Advertisement
Sign in to follow this  

Proper object transparency

This topic is 4948 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement