Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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:
    345
    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?