Shadows: incorrect offset behavior under lighting
Description
After recent changes (2.21.*), shadow rendering started to behave incorrectly when lights use offset parameters (e.g., shadowBias, shadowNormalBias, or custom offset uniforms). The offsets no longer affect the shadow term as expected, which leads to visible artifacts such as:
- Shadow acne / self-shadowing even with previously working bias values
- Shadows detaching from objects or shifting incorrectly when light direction changes
- Inconsistent results between different lights in the same scene
This issue appears only when lighting is active and shadows are enabled. Disabling lights or using a constant direction without offsets hides the problem.
Expected behavior:
Shadow offsets should consistently shift the depth comparison in the shadow map, reducing acne and keeping shadows aligned with geometry across different light configurations.
Actual behavior:
Offsets are either ignored, applied in the wrong space, or produce non-linear/unstable results depending on light setup.
Steps to reproduce:
- Enable shadows and at least one dynamic light.
- Set non-zero shadow bias / offset values that previously worked correctly.
- Observe shadow artifacts (acne, detachment, or incorrect shifting) on static and dynamic objects.
- Compare with the same setup before the recent changes (or with offsets set to zero).
Source: playcanvas/engine