• Advertisement
Sign in to follow this  

How to handle transparent objects

This topic is 4104 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
hmm.... I do have backface culling turned on. Is there anything else that could cause flickering? All I have is a cube.

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
Here's what the flickering looks like.

http://picasaweb.google.com/nikhilhs1110/Flickering

It does not happen when it's opaque.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement