Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Render Queue Shining Promblem

Discussion in '2D' started by Uwei, May 20, 2015.

  1. Uwei

    Uwei

    Joined:
    Mar 27, 2015
    Posts:
    6
    I hav three 2D's gameobject,A,B and C.

    I put them in the same position like a paper doll.

    And A's render queue is 4000,B's render queue is 4001 and C's render queue is 4002

    When the anim play they are shining

    sometimes B will behind A,but sometimes B will in front of A

    I hav ever try play A's,B's and C's anim separatly.

    It's no shining when they are separate.
     
  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    This is called "z-fighting" and it happens when you have 2 renderable surfaces at nearly the same position. When objects are far apart, the depth testing part of the rendering system can tell which one is in front (and should therefore be shown). However, when the objects are too close, the depth tester doesn't know which one to show, so it "guesses" (there's a more technical explanation for this, but I won't get into that).

    You'll have to separate the objects out so they aren't right on top of each other (use the z-axis if this is a 2D game). If you MUST have them in the same position, you'll need to look up how stenciling works and you'll need to write a custom shader.
     
  3. Uwei

    Uwei

    Joined:
    Mar 27, 2015
    Posts:
    6
    Thanks you!

    I slove the question by using the shader's offset value