From fa14707691d68b58ea11e5e17dd0a4eae36ccdbb Mon Sep 17 00:00:00 2001 From: Jaye Geary Date: Sun, 11 Feb 2018 19:27:10 +1030 Subject: [PATCH] Updates 2D Noise Function Scaling to [-1, 1] --- Source/SimplexNoise/Private/SimplexNoiseBPLibrary.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/SimplexNoise/Private/SimplexNoiseBPLibrary.cpp b/Source/SimplexNoise/Private/SimplexNoiseBPLibrary.cpp index 780aced..ccd2706 100644 --- a/Source/SimplexNoise/Private/SimplexNoiseBPLibrary.cpp +++ b/Source/SimplexNoise/Private/SimplexNoiseBPLibrary.cpp @@ -222,7 +222,8 @@ float USimplexNoiseBPLibrary::SimplexNoise2D(float x, float y) // Add contributions from each corner to get the final noise value. // The result is scaled to return values in the interval [-1,1]. - return 40.0f * (n0 + n1 + n2); // TODO: The scale factor is preliminary! + //return 40.0f * (n0 + n1 + n2); // TODO: The scale factor is preliminary! //These values currently scale from ~ [-0.884343445, 0.884343445] + return 40.0f / 0.884343445f * (n0 + n1 + n2); //accurate to e-9 so that values scale to [-1, 1], same acc as F2 G2. }