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

Diagonal Line Artifact Through Overlapping Sprites

Discussion in '2D' started by jpvanoosten, Nov 18, 2022.

  1. jpvanoosten

    jpvanoosten

    Joined:
    Nov 20, 2009
    Posts:
    42
    I'm working on a 2D project that uses flipbook animations with sprites.
    The background layer has fullsccreen static sprite that doesn't move or change.
    The foregound layer has a fullscreen sprite that is changed to create the animation.
    When both the background and the foreground sprites overlap with exactly the same diagonal, there is an artifact that get's drawn across the foreground sprite (as seen in the screenshot below). I think this diagonal line is the triangle edge of the quads used to render the sprites.
    upload_2022-11-18_16-5-21.png
    If I offset either the background layer or the foreground layer by just 1 pixel, the line dissapears.
    Changing the Z position of either sprite or the camera makes no difference.
    The two sprites are on different sorting layers, but changing the sorting layers makes no difference.
    This issue appears in about 180 scenes and I need a way to fix this without jittering either sprite!

    Maybe this can be fixed with enabling AA or something?

    Any ideas?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    Flip the scene view to show wireframe... are those pixels actually along a geometry seam?

    Also, perhaps try turning off compression on the images?
     
  3. jpvanoosten

    jpvanoosten

    Joined:
    Nov 20, 2009
    Posts:
    42
    I fixed it by disabling MSAA:
    upload_2022-11-18_16-22-8.png
    upload_2022-11-18_16-23-10.png
     
  4. jpvanoosten

    jpvanoosten

    Joined:
    Nov 20, 2009
    Posts:
    42
    This is the wireframe view:
    upload_2022-11-18_16-25-29.png
    So yeah, I suppose the line is going through the triangle seam.

    Even if it fixed it, it's not an option as there are literally hundereds of fullscreen sprites. Disabling compression would make the executables massive and WebGL is one of the target platforms.

    Anyways, disabling MSAA in quality settings seems to have fixed it and doesn't reduce the resulting quality so I'm going with this!

    Thanks for your response!
     
    Kurt-Dekker likes this.