Jump to content
  • Advertisement
Sign in to follow this  
swordyijian

problems of transparency

This topic is 3907 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

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
Advertisement
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 you'll either need to break up your geometry into chunks that are more easily sortable, or you'll need to look into something like depth peeling for order-independent blending.

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
Depth peeling isn't exactly a common technique...I don't think there are any simple examples or anything for you to look at. This paper would be a good place to start, though.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!