Search Unity

Question How to fix Moire effect (I think)

Discussion in 'General Graphics' started by Baasbase, Sep 11, 2022.

  1. Baasbase

    Baasbase

    Joined:
    Oct 1, 2020
    Posts:
    4
    I think it's the Moire effect that I'm suffering from, though it's hard to properly search for this issue so please correct me if I'm wrong.

    Anyway, a picture is worth more than a thousand words, so here's a video :)
    https://imgur.com/a/W56s9fc

    It seems less bad when using mip-maps, though at this point I'm really not sure anymore.
    It's a packed texture with 16x16 sprites, I've tried experimenting with a border of transparent pixels between sprites, and with the border of the sprite duplicated, if that makes any sense (see image below).
    None of that fixed this issue
    I'm using a Tilemap renderer and an ortographic camera.
    Is there a way to fix this jittery effect, other than using fixed zoom levels for the camera?

    maze.png
     
  2. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    672
    My first guess would be aliasing, as you already suspected.

    Make sure the texture has mipmaps and trilinear or anisotropic filtering is enabled.
     
    Jack_Truong likes this.
  3. Baasbase

    Baasbase

    Joined:
    Oct 1, 2020
    Posts:
    4
    Thanks for the quick response.
    I forgot to mention that I tried different anti-aliasing settings as well. It's the same result whether it's turned off or on.
    With trilinear filtering it's less bad, but still in a state I can't ship. Plus, I need point filtering for the graphics to not look horrible up close.
    I frankly don't know how to do anisotropic filter, I'll read up on that on Google and I'll report back.
    Thanks again!

    Edit: Anisotropic filtering was enabled by default

    Edit2: 2 more pictures uploaded https://imgur.com/a/6AYq3fU
     
    Last edited: Sep 11, 2022
  4. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    672
    If you need point filtering, it's difficult because Unity doesn't support setting different filters for minification, maxification and mip-level sampling. I think, you'd want D3D12_FILTER_MIN_MAG_POINT_MIP_LINEAR usually.

    You could try resizing the texture in an image editor with point filtering to make it 10x as big and then use trilinear sampling. Not great, I know.

    To enable anisotropic filtering with 16 samples, set aniso level to 16. It probably doesn't provide any benefit over trilinear sampling, though. Anisotropic filtering is needed when you're viewing at the texture from a shallow angle but you're looking at it from straight above.
     
  5. Baasbase

    Baasbase

    Joined:
    Oct 1, 2020
    Posts:
    4
    I'll try upscaling the textures, I'll also read more about filtering options, since I'm not knowledgeable on the subject.
    I appreciate the help. It's not the end of the world since I can used fixed zoom levels, but some players have complained that the zoom steps are too large when zoomed out, which is fair.
    At the end of the day only so many pixels can fit on a screen, so I understand why this is an issue.
    Thanks again for the response!