From bc9babdace50697e716734cc2ef77ac840e6dcd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=A8=81=E5=BB=89=E4=BC=AF=E7=88=B5?= <958261649@qq.com> Date: Mon, 21 Aug 2023 15:01:01 +0800 Subject: [PATCH 1/2] fix infinite compiling when PBR is enable --- package/Shaders/Lighting.hlsl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/Shaders/Lighting.hlsl b/package/Shaders/Lighting.hlsl index 2ac64bac8..e22854d78 100644 --- a/package/Shaders/Lighting.hlsl +++ b/package/Shaders/Lighting.hlsl @@ -1813,17 +1813,18 @@ PS_OUTPUT main(PS_INPUT input) # elif defined(SPARKLE) specularColor *= glossiness; # endif // SPECULAR -# endif // !defined(PBR) + if (useSnowSpecular) { specularColor = 0; } -# if defined(AMBIENT_SPECULAR) +# if defined(AMBIENT_SPECULAR) float viewAngle = saturate(dot(modelNormal.xyz, viewDirection)); float ambientSpecularColorMultiplier = exp2(AmbientSpecularTintAndFresnelPower.w * log2(1 - viewAngle)); float3 ambientSpecularColor = AmbientSpecularTintAndFresnelPower.xyz * saturate(mul(DirectionalAmbient, float4(modelNormal.xyz, 0.15))); specularColor += ambientSpecularColor * ambientSpecularColorMultiplier.xxx; -# endif // AMBIENT_SPECULAR +# endif // AMBIENT_SPECULAR +# endif // !defined(PBR) # if !defined(PBR) && (defined(ENVMAP) || defined(MULTI_LAYER_PARALLAX) || defined(EYE)) # if defined(CPM_AVAILABLE) && defined(ENVMAP) From 4334abd1e3f8c64297d45532032171343850ac1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=A8=81=E5=BB=89=E4=BC=AF=E7=88=B5?= <958261649@qq.com> Date: Mon, 21 Aug 2023 15:20:03 +0800 Subject: [PATCH 2/2] Fix infinite compiling when PBR is enable --- package/Shaders/Lighting.hlsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/Shaders/Lighting.hlsl b/package/Shaders/Lighting.hlsl index e22854d78..b313f541b 100644 --- a/package/Shaders/Lighting.hlsl +++ b/package/Shaders/Lighting.hlsl @@ -1915,9 +1915,9 @@ PS_OUTPUT main(PS_INPUT input) psout.Albedo.xyz = color.xyz - tmpColor.xyz * FrameParams.zzz; -# if defined(SNOW) +# if defined(SNOW) && !defined(PBR) psout.SnowParameters.x = dot(lightsSpecularColor, float3(0.3, 0.59, 0.11)); -# endif // SNOW +# endif // SNOW && !PBR psout.MotionVectors.xy = SSRParams.z > 1e-5 ? float2(1, 0) : screenMotionVector.xy; psout.MotionVectors.zw = float2(0, 1);