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.
  2. Dismiss Notice

Resolved Screen space normals estimation from depth.

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

  1. TexelBender

    TexelBender

    Joined:
    Feb 6, 2020
    Posts:
    2
    Hi, I'm experimenting on normal estimation from depth map to use it on some screen space effects with blit pass. So far normals looks ok, but I couldn't figure out what causing this faceted look. How can I get smooth normals? Blit pass is before post processing BTW.


    normal2.png normal.png
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    You can't.

    You're estimating the normals based on the actual surface geometry. The actual geometry is flat, so the estimated normals are too. The smooth surfaces you get when rendering a mesh normally are entirely a lie since it's ignoring the real geometry's normals and replacing them with arbitrary per vertex vectors that are being interpolated over the triangle.

    The only way to get smooth normals is to render the mesh's interpolated vertex normals to a screen space texture, like Unity does when you enable the DepthNormalsTexture on the main camera, or when using deferred rendering.
     
    TexelBender likes this.
  3. TexelBender

    TexelBender

    Joined:
    Feb 6, 2020
    Posts:
    2
    Thank you for the explanation.