Skip to content

Commit 7df184c

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.0] [URP] Fixing an issue with fading baked shadows when Real-Time Additional Shadows are disabled (UUM-93148)
Fixes an issue when Real-Time Additional Light Shadows are disabled but using baked shadows. The issue is that `_AdditionalShadowParams` is not included nor updated when real-time shadows are disabled. This PR reverts the behaviour to what it was before. A follow-up PR may come to add the feature for baked shadows only.
1 parent 5d46f33 commit 7df184c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • Packages/com.unity.render-pipelines.universal/ShaderLibrary

Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ float4 TransformWorldToShadowCoord(float3 positionWS)
355355
#else
356356
half cascadeIndex = half(0.0);
357357
#endif
358-
358+
359359
float4 shadowCoord = float4(mul(_MainLightWorldToShadow[cascadeIndex], float4(positionWS, 1.0)).xyz, 0.0);
360360
#endif
361361
return shadowCoord;
@@ -493,6 +493,12 @@ half AdditionalLightShadow(int lightIndex, float3 positionWS, half3 lightDirecti
493493
half realtimeShadow = AdditionalLightRealtimeShadow(lightIndex, positionWS, lightDirection, shadowParams, samplingData);
494494

495495
#ifdef CALCULATE_BAKED_SHADOWS
496+
// This fading of the baked shadow using the light's shadow strength parameter needs
497+
// to be guarded against the Real-Time Shadow keyword as _AdditionalShadowParams is
498+
// only included in URP Shaders and updated when real time additional shadows are enabled.
499+
#ifndef ADDITIONAL_LIGHT_CALCULATE_SHADOWS
500+
shadowParams.x = half(1.0);
501+
#endif
496502
half bakedShadow = BakedShadow(shadowMask, occlusionProbeChannels, shadowParams);
497503
#else
498504
half bakedShadow = half(1.0);

0 commit comments

Comments
 (0)