Jump to content
  • Advertisement
Sign in to follow this  
nickwinters

How to handle transparent objects

This topic is 4255 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 just got a transparent cube rendering correctly, but as it rotates, sometimes it flickers. I'm aware that objects that are not fully transparent need to be sent to the vid card front to back. How do I handle this if things in a vertex buffer are not in that order? Do I really need to break it down triangle by triangle? Thanks. -Nick

Share this post


Link to post
Share on other sites
Advertisement
If you turn on backface culling, and only render the triangles that are facing the camera, then any convex object (like a cube) will render correctly (but you won't see the back-side, of course).

You can also split front- and back-faces into two separate primitives, and then sort all faces using a DAG, so that, no matter what direction you view the mesh from, the visible faces (depends on backface culling!) are drawn back-to-front. This works for convex shapes, and many, but not all, concave shapes (a "T" shape works, a "X" shape does not, because there are cycles in rendering order).

You can also sort each triangle, each time you draw. That works for most non-self-intersecting shapes. However, if two triangles cross each other, the only way to draw that right, transparently, is to split the triangles along the plane of intersection, and then draw.

Yes, this is complex.

Share this post


Link to post
Share on other sites
Could you explain flicker a bit more? If you only adjust the code so as to draw it opaque, does the problem persist or no?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!