From a7280b185f522773b4a4c1e597f0e50f354b1c89 Mon Sep 17 00:00:00 2001 From: grilledham Date: Tue, 12 Jun 2018 00:16:20 +0100 Subject: [PATCH] stopped perlin noise returning zero on integer inputs --- map_gen/shared/perlin_noise.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/map_gen/shared/perlin_noise.lua b/map_gen/shared/perlin_noise.lua index e9f84eb7..37b14e84 100644 --- a/map_gen/shared/perlin_noise.lua +++ b/map_gen/shared/perlin_noise.lua @@ -36,6 +36,11 @@ function perlin:noise(x, y, z) y = y or 0 z = z or 0 + -- This prevents integer inputs returning 0, which casues 'straight line' artifacts. + x = x - 0.55077056353912 + y = y - 0.131357755512 + z = z - 0.20474238274619 + -- Calculate the "unit cube" that the point asked will be located in local xi = bit32.band(math.floor(x),255) local yi = bit32.band(math.floor(y),255)