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.

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


    Dec 24, 2013
    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:

    The rendering in the game view:

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

    The rendering debugger set to Alpha common material property shows that:
    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?