Search Unity

Question Why is this yellow glowing edge aliasing so badly?

Discussion in 'General Graphics' started by Charlicopter, Nov 22, 2022.

  1. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    125
    I'm using URP + 8x-MSAA
    The aliasing is over 2-px deep @ 1920x1080.
    The yellow glowing line is a separate material.

     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    Does it still happen if you remove the bloom (and use simple lit/lit if you use custom shaders)?
     
  3. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    672
    Yeah, bloom is calculated by first downsampling and then upsampling the picture again. My guess is that the line is so thin that some parts (pixels) of it get lost during that process.

    You could take a capture in RenderDoc to check that theory (built-in Frame Analyzer might also work)
     
    DevDunk and Charlicopter like this.
  4. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    125
    I think you're right.

    When I turn off bloom, it looks a little better. I'm still not very impressed with the result though.

    Note: This is a VR project...

    Spectator Camera (Bloom)


    Spectator Camera (No Bloom)


    VR HMD (Bloom)


    VR HMD (No Bloom)
     
  5. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    A few ideas.. check the texture's mipmapping, maybe try different mipmap filtering, try 'preserve coverage' if transparent, also if the material is using alpha clipping make sure it's not set too high (i.e. change to 0.0001 and see if that helps), or could if all else fails could try modifying the texture itself ..maybe duplicate the layer that has your line then blur the duplicate and set to additive and tweak the opacity or put it underneath the original layer if transparent. I notice things like this before, and that they go away if you increase URP Asset's Render Scale to like 120% or more, but it's hard to justify adding performance overhead by default unless a person really wants the quality (personally I went with providing a graphics option slider for it). Another way I've fixed similar issue on a per-shader basis was using Sample Texture 2D LOD node in Shader Graph to force it to use whatever specific mip levels.
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    None of that is going to be that helpful. Increasing the Render Scale is the only thing that might help, but it's not really the solution.

    This is the real problem.

    Almost all post process effects out there will do a cheap downscale at the start, often something like "copy frame buffer to a new target that's 4x smaller". This will always lead to aliasing, but it is a massive performance improvement over properly downscaling the image.

    The only solution is to modify URP's built in bloom, or implement your own (which due to the way URP's post processing works will still require you modify the URP's post processing stack directly.)