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?
In case of transparency, you need to sort the objects in depth order.
Yes, i do sort them.
However, this effect appears no matter I use sort or not.
You also need to make sure backface culling is on and that your triangles all have the proper orientation.
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.
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.
Oh, thanks a lot!
I just switched on the backface culling. It was so easy…