Sign in to follow this  
swordyijian

problems of transparency

Recommended Posts

i have several objects to render,these objects are intercrossed each other. But i found it hard to deal with the problems of transparency, because i can not see objects behind the thransparent objects. I do not know how to deal with the relation between transparency and z buffer.

Share this post


Link to post
Share on other sites
If you are rendering objects that are using traditional alpha-blending (not additive blending), you need to sort them so that they are in back-to-front order. This way you draw the back ones first, and blend the overlapping surfaces with the previous. The easiest way to do this is to transform the center position of each transparent object by your view matrix and then sort by the z value of the resulting vectors.

Share this post


Link to post
Share on other sites
then how to use directx to do the "depth peeling"? should i create a surface to store the depth value? but how can i compare the depth value stored in the created surface? where can i find the directx examples?

Share this post


Link to post
Share on other sites
Another option that may work (depending on your situation) is to simply disable depth writes while you are drawing your transparent objects. Eg,

dxDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
//render
dxDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );

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