hey there,
i have a shader that fades out alpha according to the distance between camera and object which works fine in most of the cases. it fades out in all passes. however, if the camera does not move but only rotate shadows start to flicker.
i managed to track it down to _WolrdSpaceCameraPos: if i fix the camera position and manually add its position to the shadow caster pass shadows are stable.
float3 worldInstancePos = UNITY_MATRIX_M._m03_m13_m23;
float3 diff = (_WorldSpaceCameraPos - worldInstancePos);
float dist = dot(diff, diff);
fade = saturate( (_DistanceFade.x - dist) * _DistanceFade.y );
can anybody confirm this?
tested on mac os using metal and opengl.