diff --git a/libs/pcg/source/perlin.cpp b/libs/pcg/source/perlin.cpp index 20264b16..9d3c87be 100644 --- a/libs/pcg/source/perlin.cpp +++ b/libs/pcg/source/perlin.cpp @@ -44,7 +44,8 @@ namespace psemek::pcg float const d01 = tx * grad_map_(ix, iy+1)[0] + (ty-1.f) * grad_map_(ix, iy+1)[1]; float const d11 = (tx-1.f) * grad_map_(ix+1, iy+1)[0] + (ty-1.f) * grad_map_(ix+1, iy+1)[1]; - return smoothstep(smoothstep(d00, d10, tx), smoothstep(d01, d11, tx), ty); + float v = smoothstep(smoothstep(d00, d10, tx), smoothstep(d01, d11, tx), ty) * std::sqrt(2.f); + return 0.5f + v * 0.5f; } }