Sign in to follow this  
nickwinters

How to handle transparent objects

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

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