Quick answer: Shadow flickering is usually caused by shadow bias being too low, making the shadow map fight with the surface. It can also be caused by low shadow resolution or cascade boundaries falling on visible surfaces.
Here is how to fix Unity shadow flickering z fighting. Shadows shimmer on surfaces that should be still. Two adjacent walls flash between their textures. These are shadow flickering and z-fighting — related but distinct depth precision problems that stem from the GPU running out of numerical precision when deciding what is in front of what.
The Symptom
Shadow acne shows up as a shimmering pattern on lit surfaces, especially at grazing angles to the light. It crawls as the camera moves. Z-fighting is different: two overlapping surfaces rapidly alternate visibility in flickering stripes. Both worsen at distance and with very small near clip values.
What Causes This
1. Shadow bias too low. The shadow map self-intersection test fails due to floating-point rounding, causing surfaces to shadow themselves in a noisy pattern.
2. Near clip plane too close to zero. The depth buffer distributes precision logarithmically. A near clip of 0.001 wastes most precision on the first few centimeters, leaving almost none for distant objects.
3. Overlapping coplanar geometry. Two triangles at the exact same position produce unpredictable depth test results that flicker each frame.
4. Shadow cascade boundaries. At cascade transitions, shadow resolution changes abruptly. Surfaces on the boundary see flickering as the camera moves and the boundary shifts.
5. Shadow resolution too low. When texels are large, shadow edges produce visible staircase patterns that shimmer with movement.
The Fix
Step 1: Increase shadow bias to stop shadow acne.
using UnityEngine;
public class ShadowFixer : MonoBehaviour
{
[SerializeField] private Light _light;
void Start()
{
// Start at 1.0, increase if acne persists
_light.shadowBias = 1.0f;
_light.shadowNormalBias = 1.0f;
// Too much causes peter panning (shadow detachment)
}
}
Step 2: Fix depth precision via the near clip plane.
var cam = GetComponent<Camera>();
// 0.1 for third-person, 0.3+ for top-down
cam.nearClipPlane = 0.1f;
cam.farClipPlane = 500f;
// Keep far/near ratio under 10000
Step 3: Tune cascades and fix overlapping geometry.
using UnityEngine.Rendering.Universal;
// Use 4 cascades for better shadow distribution
urpAsset.shadowCascadeCount = 4;
urpAsset.mainLightShadowmapResolution = 2048;
// For coplanar surfaces: offset one by 0.001 along its normal
// For decals: use Offset -1, -1 in the shader
Related Issues
If the visual issue is camera stutter rather than surface flickering, see Cinemachine camera jitter and stutter. If particle effects refuse to appear despite rendering looking correct, check particle system not playing.
Near clip 0.001 is the single biggest source of z-fighting in Unity projects.