Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Help Wanted Post Processing - how to draw texture onto CameraDepthTexture?

Discussion in 'Shaders' started by SniperED007, Jun 30, 2020 at 5:57 PM.

  1. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    165
    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?
     
unityunity