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 URP SSAO in custom shader / URP Clear event

Discussion in 'Shaders' started by thelebaron, Jan 29, 2021.

  1. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    777
    I'm trying to make my (non shadergraph) shader work with URP's SSAO. Its largely based on the Simple lit with modifications to lighting and to make it dots compatible.

    The frame debugger shows Depth and Depth Normals being rendered properly, ssao occlusion, horizontal, vertical and final blurs looking identical until a final `Clear(Z+Stencil)` event happens which clears the result. So ssao is being applied properly and then getting cleared, but I cant figure out whats clearing it.

    left my shader, right lit
    Unity_Y2zN4cdIXJ.png frame debugger showing similar results
    Unity_tydJIKOzWe.png similar results
    Unity_k38RwYSFkJ.png "clear" event is the difference maker

    What is `Clear(Z+Stencil)`? Where is its functionality defined in either the lit or simple lit shaders? Ive gone through and compared my code and I cant figure out whats missing.