Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Alpha clipping over opaque background generates transparency in output and post-process problems

Discussion in 'High Definition Render Pipeline' started by MGC_Marc, Jan 15, 2023.

  1. MGC_Marc

    MGC_Marc

    Joined:
    Dec 24, 2013
    Posts:
    36
    Hi there,

    I'm using HDRP 12.1.8 with Unity 2021.3.15f1 (LTS), and I'm experiencing strange behavior with the opaque material (with alpha clipping) and the post processing effects.

    Here is an example to show you my problem. I made a new scene from HDRP template, I have just added a floor, a wall, and a plane with a HDRP lit Material. This material is opaque, with an alpha clipping (threshold 0.5) and a base color texture (TGA file, RGB is all black, Alpha is a white disk).
    The rendering path is forward. The buffers for color rendering and post-process have been set to R16G16B16A16. The scene view:
    1.jpg

    The rendering in the game view:
    2.jpg

    Everything looks fine...but when I start playing with the post-effects exposure settings, here is the result:
    3.jpg
    Do you see the outline around the disk?
    And if I make the scene brighter:
    4.jpg
    The outline is still there.

    The rendering debugger set to Alpha common material property shows that:
    5.jpg
    Furthermore, when I export the rendering to exr format, there is indeed a transparent area all around the disk.
    I don't really understand why the tonemapper or exposure effects produce this outline. It's like if the transparent part of the image was not processed by these effects at all, and remains grey.

    This outline disappears when I switch the post-effect buffer to R11G11B10, or if I change the material type to transparent (which is what I would like to avoid, the framerate is then impacted, and it adds sorting issues).

    Do you think the dark outline in the alpha channel of the output is normal, even if the clipped material is over an opaque background or sky? To me, this looks strange. But maybe is it a limitation of the alpha clip effect?
     
  2. MGC_Marc

    MGC_Marc

    Joined:
    Dec 24, 2013
    Posts:
    36