diff --git a/Client/Assets/Game/shader/XShader/XPbr_Base.hlsl b/Client/Assets/Game/shader/XShader/XPbr_Base.hlsl index 23592b91..1bd6adac 100644 --- a/Client/Assets/Game/shader/XShader/XPbr_Base.hlsl +++ b/Client/Assets/Game/shader/XShader/XPbr_Base.hlsl @@ -122,7 +122,10 @@ void InitializeInputData(Varyings input, half3 normalTS, out InputData inputData #else inputData.bakedGI = SampleSH(inputData.normalWS); #endif - inputData.bakedGI = SampleXRuntimeAmbient(inputData.normalWS); + // 仅在运行时全局环境光开启后才覆盖(Game.cs 设置);否则保留场景自身 SH/光照贴图, + // 避免编辑器预览比 URP Lit 亮(旧写法无条件覆盖成硬编码的高强度三色环境光) + if (_XRuntimeAmbientEnabled > 0.5h) + inputData.bakedGI = SampleXRuntimeAmbient(inputData.normalWS); inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); diff --git a/Client/Assets/Game/shader/XShader/XTerrain_Base.hlsl b/Client/Assets/Game/shader/XShader/XTerrain_Base.hlsl index 8a83bb34..b9641edb 100644 --- a/Client/Assets/Game/shader/XShader/XTerrain_Base.hlsl +++ b/Client/Assets/Game/shader/XShader/XTerrain_Base.hlsl @@ -147,7 +147,10 @@ void InitializeInputData(Varyings input, half3 normalTS, out InputData inputData #else inputData.bakedGI = SampleSH(inputData.normalWS); #endif - inputData.bakedGI = SampleXRuntimeAmbient(inputData.normalWS); + // 仅在运行时全局环境光开启后才覆盖(Game.cs 设置);否则保留场景自身 SH/光照贴图, + // 避免编辑器预览比 URP Lit 亮(旧写法无条件覆盖成硬编码的高强度三色环境光) + if (_XRuntimeAmbientEnabled > 0.5h) + inputData.bakedGI = SampleXRuntimeAmbient(inputData.normalWS); inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); diff --git a/Client/Assets/Game/shader/XShader/XTex_Base.hlsl b/Client/Assets/Game/shader/XShader/XTex_Base.hlsl index dbae7161..aa0cdcd0 100644 --- a/Client/Assets/Game/shader/XShader/XTex_Base.hlsl +++ b/Client/Assets/Game/shader/XShader/XTex_Base.hlsl @@ -149,7 +149,10 @@ void InitializeInputData(Varyings input, half3 normalTS, out InputData inputData #else inputData.bakedGI = SampleSH(inputData.normalWS); #endif - inputData.bakedGI = SampleXRuntimeAmbient(inputData.normalWS); + // 仅在运行时全局环境光开启后才覆盖(Game.cs 设置);否则保留场景自身 SH/光照贴图, + // 避免编辑器预览比 URP Lit 亮(旧写法无条件覆盖成硬编码的高强度三色环境光) + if (_XRuntimeAmbientEnabled > 0.5h) + inputData.bakedGI = SampleXRuntimeAmbient(inputData.normalWS); inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);