Search Unity

Resolved MSAA breaks alpha blended rendering

Discussion in 'Universal Render Pipeline' started by CianNoonan, Jan 27, 2021.

  1. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    I'm rendering a mesh with MSAAx8 enabled(though the issue occurs at varying severity at x2 and x4). I sample a texture and pass the value from the texture to the color.a returned in the frag. You can see in the screenshots that the result is stepping with MSAA enabled and a clean cut with MSAA disabled.

    MSAA on
    unknown.png
    MSAA off
    unknown (1).png
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Is alpha to coverage being used?
     
  3. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    Yep, used in both the shader with the ShaderLab toggle "AlphaToCoverage 1" and attempted in the texture import settings but it changes nothing
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Well I would blame Alpha to Coverage for causing that problem. It should be disabled and the pass should be opaque not transparent (though I can't see this mattering), for MSAA to function out of the box.

     
  5. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    Disabling A2C makes the object fully opaque. I'm not sure why that's happening now. Even if I toggle off MSAA, disabling A2C disabled any transparency
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  7. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    I've worked it out, the banding is due to the 4 levels of alpha afforded by coverage, the bgolus articles shows how to remap the 256 alpha into the coverage correctly
     
  8. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723