CultMath 0.4.0: name all three empirical constants; float32 ulp neighbours of the snoise tie set

CHANGELOG and package README: the noise enclosures rest on SNOISE_LIPSCHITZ,
SNOISE2_LIPSCHITZ and SNOISE_HESSIAN, all empirical with a margin; the README
bullet no longer says "with a proof" or "every point". Breaking: inputs within a
few float32 ulps of the tie set can also change (probe: none at 1e-5 or more,
a handful at 1e-6 near magnitude 30). Text only; builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-09 23:37:24 +02:00
commit d6a31416fd
2 changed files with 24 additions and 14 deletions

View file

@ -36,16 +36,19 @@ shader semantics.
It includes `shaders/CultMath.Phacelle.hlsl` (MPL-2.0) and
`shaders/CultMath.Interval.hlsl` and `shaders/CultMath.Affine.hlsl` from the same
directory, so ship all four.
- interval arithmetic for culling empty space with a proof: `iv_*` functions
- interval arithmetic for culling empty space: `iv_*` functions
over `float2(lo, hi)` (`iv_add`, `iv_mul`, `iv_exp`, `iv_smoothstep`, ...)
and `iv_snoise_ball`/`iv_fbm_ball`, which bound `snoise` and `fbm_grad` over a
ball, and `iv_frustum_ball`, the ball around a screen tile's rays over a depth
segment, so one probe serves the whole tile (its radius carries its own
float32 rounding bound). Every one returns an interval
containing the function's value at every point of its input, so a raymarch
float32 rounding bound). The arithmetic functions return an interval built to
contain the function's value over their operand intervals, so a raymarch
can skip a segment whose `hi` is below its cutoff; `cultmath_iv_*` in HLSL.
The two noise balls rest on `SNOISE_LIPSCHITZ`, an empirical bound with a
margin that the enclosure tests sample, not a proof.
The noise functions rest on empirical constants with a margin, not a proof:
`iv_snoise_ball(float3)`, `iv_fbm_ball` and `iv_frustum_ball` on
`SNOISE_LIPSCHITZ`, `iv_snoise_ball(float2)` on `SNOISE2_LIPSCHITZ`, and
`af_snoise`, `af_fbm` and `af_frustum_ball` on `SNOISE_HESSIAN` and
`SNOISE_LIPSCHITZ`; the enclosure tests sample them.
The bounds compose with a consumer's own analytic envelope (a height fog, a
carved sphere): its interval over the segment proves empty space in one probe,
and the noise ball is consulted only near the surface. See `docs/design.md`,

View file

@ -20,9 +20,13 @@ backfilled here; see `docs/semver-policy.md` for why.
`snoise(0, 0, 0)` was -0.4358730 and is 0, `snoise(5, 0, 0)` was 0.7076616 and
is 0.671713, and `snoise(1, 2, 3)` was 0.22423841 and is 0. Float32 rounding
decides whether a given input ties, and an input that ties may still keep its
value; measured over random integer points, about 97% change. Off that set
the results are bit-identical to 0.3.0
(`SnoiseTieScopeTests`, goldens computed by the 0.3.0 DLL). `snoise` is now
value; measured over random integer points, about 97% change. The cell offset
is computed in float32, so inputs within a few float32 ulps of that set can tie
and change too (a probe over random inputs found none at a distance of 1e-5 or
more from the set, and a handful at 1e-6 near magnitude 30; computed
coordinates such as `i * 0.1f` can land there). Elsewhere the results are
bit-identical to 0.3.0 (`SnoiseTieScopeTests`, goldens computed by the 0.3.0
DLL). `snoise` is now
continuous across the diagonals to within 1e-4 over two ulps either side
(`NoiseGradTests`, `SnoiseIsContinuousOnTheSimplexDiagonal`). Anything keyed
on integer lattice coordinates (voxel or tile seeds, cell centres, generated
@ -36,12 +40,15 @@ backfilled here; see `docs/semver-policy.md` for why.
`iv_saturate`, `iv_lerp`, `iv_sqr`, `iv_sqrt`, `iv_exp`, `iv_smoothstep`,
`iv_snoise_ball` (`float3` and `float2` centres), `iv_fbm_ball` and
`iv_frustum_ball`, with the HLSL mirrors in the new
`Shaders/CultMath.Interval.hlsl`. Each function returns an interval that
contains the pointwise float32 result for every input in the operand
intervals, except that `iv_snoise_ball` and `iv_fbm_ball` rest on
`SNOISE_LIPSCHITZ`, an empirical bound with a margin and not a proof. The
enclosure tests sample points and check containment without a tolerance; they
do not prove it for every input.
`Shaders/CultMath.Interval.hlsl`. Each function is built to return an interval that
contains the pointwise float32 result for the operand intervals, but the noise
functions rest on empirical constants with a margin, not on a proof:
`iv_snoise_ball(float3)`, `iv_fbm_ball` and `iv_frustum_ball` on
`SNOISE_LIPSCHITZ`, `iv_snoise_ball(float2)` on `SNOISE2_LIPSCHITZ`, and
`af_snoise`, `af_fbm` and `af_frustum_ball` (below) on `SNOISE_HESSIAN` and
`SNOISE_LIPSCHITZ`. The enclosure tests sample
points and check containment without a tolerance; they do not prove it for
every input.
- Reduced affine forms on `float3(x0, a, e)` that share one symbol over a
region: `math.af_point`, `af_symbol`, `af_range`, `af_from_iv`, `af_add`,
`af_add_iv`, `af_sub`, `af_neg`, `af_scale`, `af_mul`, `af_snoise`, `af_fbm`,