PDA

View Full Version : Stripes on a transparent object



bliss
02-22-2011, 01: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).

https://sites.google.com/site/asasddfgaerwqsd/home/ball_stripes.png

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

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

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

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

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

ZbuffeR
02-22-2011, 03: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.

dukey
02-22-2011, 03: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.

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