From 5e98eefcc27cdcc4bce4b69e191c4e321a0f91ff Mon Sep 17 00:00:00 2001 From: Ken Pruiksma Date: Wed, 7 Jul 2021 17:13:43 -0500 Subject: [PATCH] Undoing change from review feedback as it led to an incorrect result in some cases. Signed-off-by: Ken Pruiksma --- .../ShaderLib/Atom/Features/PBR/Lights/Ltc.azsli | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ltc.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ltc.azsli index 8042758db8..6e45cf30c8 100644 --- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ltc.azsli +++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ltc.azsli @@ -111,13 +111,9 @@ float IntegrateEdge(float3 v1, float3 v2) float IntegrateEdgeDiffuse(float3 v1, float3 v2) { float cosTheta = dot(v1, v2); - float theta_sinTheta = 0.0; - if (cosTheta > 0.0) - { - float absCosTheta = abs(cosTheta); - theta_sinTheta = 1.5708 + (-0.879406 + 0.308609 * absCosTheta) * absCosTheta; - } - else + float absCosTheta = abs(cosTheta); + float theta_sinTheta = 1.5708 + (-0.879406 + 0.308609 * absCosTheta) * absCosTheta; + if (cosTheta < 0.0) { theta_sinTheta = PI * rsqrt(1.0 - cosTheta * cosTheta) - theta_sinTheta; }