Skip to content

Commit 427fc33

Browse files
SSAO: Fix FastACos approximation
1 parent b5de69b commit 427fc33

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Shaders/PostProcess/ScreenSpaceAmbientOcclusion/private/SSAO_ComputeAmbientOcclusion.fx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ float2 ComputeSliceDirection(float Xi, int Index)
4646

4747
float FastACos(float Value)
4848
{
49-
float Result = -0.156583 * Value + M_HALF_PI;
50-
Result *= sqrt(1.0 - abs(Value));
49+
float AbsValue = abs(Value);
50+
float Result = -0.156583 * AbsValue + M_HALF_PI;
51+
Result *= sqrt(1.0 - AbsValue);
5152
return (Value >= 0.0) ? Result : M_PI - Result;
5253
}
5354

0 commit comments

Comments
 (0)