diff --git a/GLSL/FastNoiseLite.glsl b/GLSL/FastNoiseLite.glsl index 4cb576f..330e7d2 100644 --- a/GLSL/FastNoiseLite.glsl +++ b/GLSL/FastNoiseLite.glsl @@ -787,8 +787,8 @@ float _fnlSingleOpenSimplex2S2D(int seed, FNLfloat x, FNLfloat y) float y0 = yi - t; int aMask = int((xi + yi + 1.f) * -0.5f); - int bMask = int((xi - float(aMask) + 2.f) * 0.5f - yi); - int cMask = int((yi - float(aMask) + 2.f) * 0.5f - xi); + int bMask = int((xi - (float(aMask) + 2.f)) * 0.5f - yi); + int cMask = int((yi - (float(aMask) + 2.f)) * 0.5f - xi); float a0 = (2.f / 3.f) - x0 * x0 - y0 * y0; float value = (a0 * a0) * (a0 * a0) * _fnlGradCoord2D(seed, i, j, x0, y0); @@ -1446,7 +1446,7 @@ float _fnlSingleValueCubic3D(int seed, FNLfloat x, FNLfloat y, FNLfloat z) _fnlCubicLerp(_fnlValCoord3D(seed, x0, y2, z3), _fnlValCoord3D(seed, x1, y2, z3), _fnlValCoord3D(seed, x2, y2, z3), _fnlValCoord3D(seed, x3, y2, z3), xs), _fnlCubicLerp(_fnlValCoord3D(seed, x0, y3, z3), _fnlValCoord3D(seed, x1, y3, z3), _fnlValCoord3D(seed, x2, y3, z3), _fnlValCoord3D(seed, x3, y3, z3), xs), ys), - zs) * (1.f / 1.5f * 1.5f * 1.5f); + zs) * (1.f / (1.5f * 1.5f * 1.5f)); } diff --git a/HLSL/FastNoiseLite.hlsl b/HLSL/FastNoiseLite.hlsl index 73a06f4..7781cbe 100644 --- a/HLSL/FastNoiseLite.hlsl +++ b/HLSL/FastNoiseLite.hlsl @@ -1714,7 +1714,7 @@ static float _fnlSingleValueCubic3D(int seed, FNLfloat x, FNLfloat y, FNLfloat z _fnlCubicLerp(_fnlValCoord3D(seed, x0, y2, z3), _fnlValCoord3D(seed, x1, y2, z3), _fnlValCoord3D(seed, x2, y2, z3), _fnlValCoord3D(seed, x3, y2, z3), xs), _fnlCubicLerp(_fnlValCoord3D(seed, x0, y3, z3), _fnlValCoord3D(seed, x1, y3, z3), _fnlValCoord3D(seed, x2, y3, z3), _fnlValCoord3D(seed, x3, y3, z3), xs), ys), - zs) * (1 / 1.5f * 1.5f * 1.5f); + zs) * (1 / (1.5f * 1.5f * 1.5f)); } // Value noise