Jump to content

  • Log In with Google      Sign In   
  • Create Account

texture issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 germangb   Members   -  Reputation: 211

Like
0Likes
Like

Posted 12 December 2012 - 04:19 PM

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

Posted Image

It looks ok, but when I watch the 2 quads from another point I have the following problem:
Posted Image

any idea?

Sponsor:

#2 AliasBinman   Members   -  Reputation: 430

Like
0Likes
Like

Posted 12 December 2012 - 04:46 PM

The best way to solve this is to sort them per frame so they are rendered back to front or to draw them with alpha testing enabled.

#3 spek   Prime Members   -  Reputation: 996

Like
0Likes
Like

Posted 12 December 2012 - 05:15 PM

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.

#4 uglybdavis   Members   -  Reputation: 910

Like
0Likes
Like

Posted 12 December 2012 - 06:45 PM

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.

#5 L. Spiro   Crossbones+   -  Reputation: 13599

Like
4Likes
Like

Posted 12 December 2012 - 06:54 PM

If you don’t have the ability to sort the objects then you need to use discard inside the shader when you detect that the alpha value is 0.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#6 Krohm   Crossbones+   -  Reputation: 3119

Like
0Likes
Like

Posted 14 December 2012 - 04:24 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS