Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite compiling when PBR is enabled #44

Merged
merged 3 commits into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions package/Shaders/Lighting.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -1945,17 +1945,18 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace)
# 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)
Expand Down Expand Up @@ -2046,9 +2047,9 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace)

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);
Expand Down