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.

Question Post Processing - how to draw texture onto CameraDepthTexture?

Discussion in 'Shaders' started by SniperED007, Jun 30, 2020.

  1. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    341
    I'm using the URP so don't have access to Light Cookies, but I was wondering would it not be possible to simulate the same effect by using a post-process effect to achieve the same effect using the Camera Depth Texture?

    I have very basic knowledge of shaders, but from what I understand I would need to get the directional light matrix and UV positions?

    Code (CSharp):
    1. float2 lightSpaceUVs = mul(unity_WorldToShadow[0], float4(_WorldSpaceLightPos0.xyz, 1)).xy;
    2. half4 caustics = tex2D(_CausticsTex, lightSpaceUVs);
    If that is correct then how do I go from that to applying it over the Camera Depth Texture?