View Full Version : Stripes on a transparent object

02-22-2011, 12:12 AM
When I load one or more partly transparent object i get the following screenshot. The effect changes as I move around objects, sometimes stripes disappear (e.g. for the far ball), and with other camera angle appear again (see image).


What might be a reason of this effect?
Opaque objects always look fine.

ps. I use shaders, made I made a bug in there?

02-22-2011, 12:36 AM
In case of transparency, you need to sort the objects in depth order.

02-22-2011, 12:42 AM
Yes, i do sort them.
However, this effect appears no matter I use sort or not.

Alfonse Reinheart
02-22-2011, 12:45 AM
You also need to make sure backface culling is on and that your triangles all have the proper orientation.

02-22-2011, 02:10 AM
In case of transparency, you need to sort the objects in depth order.
To be more precise, all triangles should be sorted to avoid this.
It is simpler to do as said Alfonse, use backface culling so that all convex objects will not need full sort.

02-22-2011, 02:37 AM
Sorting makes baby jesus cry.

Just draw the transparent object with colour writing disabled (to fill the depth buffer), then draw again normally over the top caring to use GL_LEQUAL. This will ensure only the front polys are drawn and u don't get this crazy artefact. For multiple overlapping transparent object, sigh you may need to sort those, unless you use weighted average order independent transparency or something.

02-22-2011, 05:34 PM
Oh, thanks a lot!
I just switched on the backface culling. It was so easy...