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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Trouble with rendering depth

Discussion in 'General Graphics' started by popMark, Dec 11, 2015.

  1. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    114
    Hi,

    I'm trying to create a render to texture of my scenes depth from an orthographic camera above the scene.

    I think the camera is setup correctly and I can generate a texture but its not as I expect, it appears banded like the depth is repeating. I was expecting a more gradiented image where the pixels near the camera were black and those further away are white. Am I doing something wrong? using the wrong shader? ("Hidden/Camera-DepthNormalTexture")
    I'm also using a custom camera projection matrix to get the camera to fit the geometry exactly.

     
  2. boundingbox

    boundingbox

    Joined:
    Mar 31, 2013
    Posts:
    30
    Is the floating point depth being encoded as 8 bit rg or rgb? That would cause the banding but would add color to more channels. I see that this texture is argb32 and not a rfloat, the only way to get accurate depth would be to encode the float across multiple channels.
     
    popMark likes this.