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

Depth pyramid scale parameter is not available,how to scale the camera depth texture in shaders ?

Discussion in 'High Definition Render Pipeline' started by nasos_333, Dec 10, 2020.

  1. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,453
    Hi,

    I was using the Depth pyramid scale variable in shader to scale the depth texture, now this parameters is no longer available,

    Is it possible to know how to scale the Depth pyramid to correctly grab the camera depth for all cases ?

    I now use a custom scaler, but seems is not the same for all scene for some reason

    E.g. in one scene my water works correctly using (1, 0.67) scaling to the UVs and another (0.475, 0.155)

    Is there any documentation on the depth pyramid texture and how to handle it in the shader or some hint on where to find some sample of it in the HDRP github ?

    Thanks a lot in advance
     
  2. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,453
    Also i noticed something else, one of my effects is adding depth texture from a top down camera to adjust water in shore lines, the way this texture is applied seems to differ from scene to scene based on what other effects and cameras i have enabled.

    E.g. in one scene i dont do a displacement of vertices based on the main camera position and works ok, but in anotther scene i have to add a -1 * currentCameraPosition in the shader to displace the vertices based on camera, otherwise the effect seems to slide when camera moves.

    Generally HDRP seems to have many different modes and i wonder if there is any documentation on why it might appear to behave so differently