# HG changeset patch # User sam # Date 1727455477 -25200 # Node ID 93a6d70d845f14b0383508242f0b5d97b3d92af7 # Parent 7b8a6b5e9a4648fb3663ef4cb1bfdbfa90a1b6c1 fix: make perlin noise 0..1 instead of -1..1 diff -r 7b8a6b5e9a46 -r 93a6d70d845f semicongine/contrib/algorithms/noise.nim --- a/semicongine/contrib/algorithms/noise.nim Wed Sep 11 23:26:08 2024 +0700 +++ b/semicongine/contrib/algorithms/noise.nim Fri Sep 27 23:44:37 2024 +0700 @@ -27,8 +27,9 @@ xinterpol = pos.x - topleft.x yinterpol = pos.y - topleft.y - return interpolate( - interpolate(topleft_dot, bottomleft_dot, yinterpol), - interpolate(topright_dot, bottomright_dot, yinterpol), - xinterpol, - ) + return + interpolate( + interpolate(topleft_dot, bottomleft_dot, yinterpol), + interpolate(topright_dot, bottomright_dot, yinterpol), + xinterpol, + ) * 0.5 + 0.5