Add Unity-compatible simplex noise semantics

This commit is contained in:
Meta Vens 2026-07-17 07:45:28 +01:00
commit cb481b4c75
5 changed files with 101 additions and 0 deletions

View file

@ -51,6 +51,7 @@ public sealed class HlslMirrorTests
"cultmath_cubic_bezier",
"cultmath_hash",
"cultmath_value_noise",
"cultmath_simplex_noise",
"cultmath_value_noise_bicubic",
"cultmath_value_noise_texture",
"cultmath_value_noise_texture_bicubic",

View file

@ -235,6 +235,16 @@ public sealed class MathTests
Assert.True(bicubic > -0.25f && bicubic < 1.25f);
}
[Theory]
[InlineData(0.0f, 0.0f, 0.0f)]
[InlineData(0.25f, -0.5f, -0.425866783f)]
[InlineData(12.25f, -4.5f, 0.258312f)]
[InlineData(536.5106f, 536.5106f, -0.6901103f)]
public void SimplexNoiseMatchesUnityMathematics(float x, float y, float expected)
{
Assert.Equal(expected, math.simplex_noise(new float2(x, y)), precision: 6);
}
[Fact]
public void VoronoiBatchProducesToneMappedColors()
{