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

Is Camera.SetTargetBuffer obsolete in HDRP?

Discussion in 'High Definition Render Pipeline' started by gebot3, Mar 9, 2020.

  1. gebot3

    gebot3

    Joined:
    Apr 6, 2015
    Posts:
    4
    Hello, this is my first post in unity forum :)

    I tried to get color and depth render texture from the second camera for my custom post-processing in HDRP, however, when I trying to do it using SetTargetBuffer the render texture result is only black texture, both for color render texture and depth render texture

    I found a workaround by using two secondary cameras, the "First" secondary camera is used to get color texture, and the "Second" secondary camera is used to get depth texture, but I prefer to use only one secondary camera because I think using two secondary cameras is not an optimal solution.


    Color Render Texture by "First" Secondary Camera


    Depth Render Texture by "Second" Secondary Camera
    Note: Secondary Camera only renders the character, that's why no depth for trees, etc.​

    Is there any better way to get both color and depth from the same camera?
     
  2. gebot3

    gebot3

    Joined:
    Apr 6, 2015
    Posts:
    4
    UPDATE :

    I managed to sample depth pass from second camera by using custom pass, now I only use one main camera and one secondary camera, however when I try sampling color camera using custom pass to get better performance the result is broken, probably because lit material is not supported yet by custom pass