Sign in to follow this  
Raduprv

Proper object transparency

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this