Search Unity

Question ShadowCasterPass without setting colormask to 0?

Discussion in 'Universal Render Pipeline' started by wechat_os_Qy0z-7zpawpqXNqcuLz4nvHLI_unity, May 26, 2023.

  1. wechat_os_Qy0z-7zpawpqXNqcuLz4nvHLI_unity

    wechat_os_Qy0z-7zpawpqXNqcuLz4nvHLI_unity

    Joined:
    Nov 10, 2022
    Posts:
    4
    Hello everyone, I'm new to URP. Now I want to render the depth of scene to a
    RenderTextureFormat.RFloat format RT instead of depth or shadowmap. The question is when I modifty the fragment shader of ShadowCasterPass, return the depth of the fragment like this:
    upload_2023-5-26_21-11-23.png
    upload_2023-5-26_21-11-40.png
    when ColorMask is zero, i get nothing in color channel,but all in depth buffer
    upload_2023-5-26_21-13-18.png
    upload_2023-5-26_21-13-4.png
    when i set colormask to A,erverthing works fine,the depth information write to the RT correctly ,but the scene looks horrible


    upload_2023-5-26_21-14-15.png
    because every fragment's color is it's depth.
    I just want to know if there is a way like inversed colormask so that only write to the RT?