Sign in to follow this  
germangb

texture issue

Recommended Posts

germangb    211
I have two 2D textured quads that always face me:

[img]http://i.imgur.com/PyK4f.png[/img]

It looks ok, but when I watch the 2 quads from another point I have the following problem:
[img]http://i.imgur.com/Ei8mI.png[/img]

any idea?

Share this post


Link to post
Share on other sites
spek    1240
That;s the good old transparency sorting issue. The solution is above, as AliesBinman explained. As well as carefully looking at your blending/transparency/depth writing options.

The reason is that you can't just draw transparent/blended pixels in random order (depending a bit on your blending and transparency testing methods enabled). In picture2, the foreground image got rendered first. Even though its transparent, also the non-filled pixels wrote a depth value to the depth buffer. After that, you rendered the second quad in the background. But before just plotting those pixels on the canvas, the graphics engine is testing if there is nothing in the foreground occluding it, by comparing depth. Monkey farts, it seems that the quad in front is blocking your way.

Sorting from back- to forward is one way to prevent this, though it still doesn't always work for quads intersecting each other. Second, check your blending / transparency testing options. Transparent pixels shouldn't write a depth value either. If you are using a shader, the fragmentshader for example could simply kill the transparent pixels to prevent this.

Share this post


Link to post
Share on other sites
uglybdavis    1065
Are you using Unity3D? (Asking because of the colors of the grid) If so, try to increase the Z of the far object. I know you don't have sort control in unity, but greater z depth's usually do the trick.

Share this post


Link to post
Share on other sites
Krohm    5030
I guess it's worth noticing there's no need to sort at all in this case.
The objects appear alpha-tested, but not alpha-blended. Fragment discard (either by KIL or alpha test) is order-independant.

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