Problem with moving tiled texture for screen-space snow effect

I can’t seem to figure out how to make it so the tiled texture does not follow the camera… It’s a shader that creates snow in screen space. Here’s a video of what I’m talking about:

jc7jn

Here’s the frag code in question:

half4 frag (v2f i) : SV_Target
            {
                half3 normal;
                float depth;
                DecodeDepthNormal(tex2D(_CameraDepthNormalsTexture, i.uv), depth, normal);
                normal = mul((float3x3)_CamToWorld, normal);
                // find out snow amount
                half snowAmount = normal.g;
                half scale = (_BottomThreshold + 1 - _TopThreshold) / 1 + 1;
                snowAmount = saturate( (snowAmount - _BottomThreshold) * scale);
                // find out snow color
                float2 p11_22 = float2(unity_CameraProjection._11, unity_CameraProjection._22);
                float3 vpos = float3( (i.uv * 2 - 1) / p11_22, -1) * depth;
                float4 wpos = mul(_CamToWorld, float4(vpos, 1));
                wpos += float4(_WorldSpaceCameraPos, 0) / _ProjectionParams.x;
                wpos *= _SnowTexScale * _ProjectionParams.z;
                half4 snowColor = tex2D(_SnowTex, wpos.xz) * _SnowColor;
                // get color and lerp to snow texture
                half4 col = tex2D(_MainTex, i.uv);
                return lerp(col, snowColor, snowAmount);
            }

Is there anyway to ‘fix the uvs’ so that the texture does not move with the camera? Also for bonus points I’m also thinking of adding shadows to this as well, but not really sure how to do that either.
Thanks!

Remove this line, this is what’s making it follow the camera:
wpos += float4(_WorldSpaceCameraPos, 0) / _ProjectionParams.x;

That’s a lot harder. Borderline impossible depending on your setup. Basically, if you’re using any baked lighting, there’s no way to do it at all as a purely screen space based effect.

For real time lighting, if your running this shader as part of the opaque queue, you should be able to access the screen space shadow texture trivially. You just need to make your shader work like any other opaque lit shader.
https://catlikecoding.com/unity/tutorials/rendering/part-7/

Alternatively, if you’re using the deferred rendering path, you can make things work like a full screen deferred decal and directly modify the gbuffers. Then real time or masked shadows will apply automatically.

The reason the line of code is in is there is because without it there’s a a weird scrolling behaviour which seems to get worse the more the camera looks down, so I think the line is necessary in the way this is currently implemented.

Is there perhaps a way I can ‘counter’ the motion of the camera and then scroll the UV in the opposite direction?

Ever manage to figure this out by any chance?