Finding cultlib-gaps:finding:cut-cultmath-release-0-5-0.s1.changelog-claims-absent-surface. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 KiB
12 KiB
Changelog
All notable changes to this package are documented in this file.
Earlier releases (0.2.0-0.2.3) predate this package's changelog and are not
backfilled here; see docs/semver-policy.md for why.
[0.5.0]
Breaking
CultPhasor.cosand.sinare now.cosineand.sinein C#, HLSL and GLSL, constructor parameters included, because SPIRV-Cross renames members that match GLSL builtins.- The
constmath.SNOISE_HESSIAN(andCULTMATH_SNOISE_HESSIAN) is re-pinned from 56.050385 to 55.642143, measured on the analyticsnoise_hessianinstead of central differences ofsnoise_grad, whose rounding read high (NoiseBoundTests). A consumer compiled against 0.4.x keeps the old value inlined until it recompiles.af_snoiseandaf_fbmread it, so their remainder terms are slightly tighter.
Changed
- The package license expression is
MIT AND MPL-2.0 AND Apache-2.0(wasMIT AND MPL-2.0): the Cycles files below are Apache-2.0 (LICENSE.md,THIRD-PARTY-NOTICES.md).
Added
- Cycles node semantics (Apache-2.0,
math.Cycles.csand the newShaders/CultMath.Cycles.hlsl):math.cycles_*andcultmath_cycles_*compute what Blender's Cycles computes for the Math node operations whose results differ from a plain intrinsic (cycles_divide,cycles_power,cycles_modulo,cycles_wrap,cycles_pingpong,cycles_smooth_min,cycles_arctan2, ...), Map Range (linear,stepped,smoothstep,smootherstep), Clamp, Mix (cycles_mix_float,cycles_mix_vectorand every colour blend mode ascycles_mix_<mode>), RGB to BW, HSV conversion andcycles_ramp_index.CyclesOracleTestsholds the C# and the HLSL mirror to fixtures recorded from Blender 5.2.2's CPU Cycles. CultMath.Expr: an immutable scalar SSA expression graph (ExprGraph, built byExprBuilderwith substitution, validated byExprGraph.Createon build and on decode), parameter bindings (ExprBindings), an evaluator (ExprEvaluator) and the op table (ExprOps). The package carries no serializer for it.- Site cells:
math.power_score,multiplicative_score, theCultSiteCellsaccumulator (site_cells_empty,site_cells_insert,site_cells_border), the exact power cell border (power_border,power_border_step) andgabriel_margin, each with an HLSL twin (cultmath_prefix); the shadercultmath_power_bordertakes a fixed-capacity site array ofCULTMATH_MAX_SITES(128 unless defined before the include).power_cells,multiplicative_cellsandsoft_gabriel_gateare C# only. - Weighted lattice cells:
math.weighted_lattice_cellswith an exact ring-exit search and its four public steps (lattice_site,lattice_weight,lattice_distance,lattice_smooth_step), the range constantsLatticeMaxBoost,LatticeMaxStretch,LatticeMaxSmoothingandLatticeMaxRing, and the HLSL twins (cultmath_weighted_lattice_cells,cultmath_lattice_cell_distance). - Span stages:
math.span_fbmandspan_ridgedover aSpanPathand aSpanStagereturnSpanNoise(field, curvature and fold), widened by float rounding allowances, with HLSL twins;cultmath_span_roundingandcultmath_span_slackown the allowances. math.snoise_hessian(float3)(float3x3), the next-order boundSNOISE_THIRD(535.8009), and the snoise read rounding constantsCULTMATH_SNOISE_READ_VALUEandCULTMATH_SNOISE_READ_GRADIENTin HLSL.math.integral_clamp_linear(a, b, lo, hi, t0, t1), the integral ofclamp(a + b t, lo, hi)over[t0, t1]in closed form, with its HLSL twin. It is finite for an infinite clamp bound, andloabovehiclamps tohieverywhere, asclampdoes.math.segment_closestand the out-freedistance_to_segmentforfloat2andfloat3, with HLSL twins.
[0.4.1]
Fixed
BoundedLeastSquares.Solveno longer reportsConvergedright after releasing a bound while another bound still violates the KKT conditions by more than the tolerance. Before, the cost-progress rule judged the pass that followed a release, and near a minimiser a cost difference resolves only about the square root of what a gradient comparison resolves, so the solve could stop with a bound's gradient ten thousand times the tolerance. Now a bound is released only when its violation exceeds both the tolerance and the rounding bound of its double gradient, and the cost-progress rule judges only passes that release nothing; a release resets the progress mark. Measured case: an allocator-shaped problem (15 rows, 12 columns) solved fromx = 0at tolerance 1e-12 returnedConvergedwith one throttle at 1, and re-solving from that answer moved it to 0.92221445, so the answer depended on the start by 0.078. It now stops at 0.92221445 and the re-solve takes 0 iterations (TheStopAfterAReleaseIsOnTheGradientNotTheCostat 1e-12 and 1e-9, and for every column position of the released bound,TheStopAfterAReleaseIsOnTheGradientWhicheverColumnWasReleased). At the default tolerance the results of the existing tests are unchanged. Results move only where the old solver stopped early; a caller that compared such a result against a stored value sees the corrected one.
Added
BoundedLeastSquares.Validate(m, n, a, b, lo, hi, kktRelativeTolerance)and the enumBoundedLeastSquaresInput(Valid,InvalidTolerance,InvalidBounds,NonFiniteMatrix,NonFiniteTarget): names the first input that breaks the contract, in that order.Solvecalls it, so it returnsInvalidInputexactly whenValidatereturns anything butValid.
[0.4.0]
Breaking
math.snoise(float3)andmath.snoise_grad, and their HLSL mirrors inShaders/CultMath.hlsl, now resolve ties among the components of the cell offset in a fixed order: x over y, y over z, x over z. The cyclic rule they used before read a different function wherever the three components of the cell offset are equal. That is every input whose coordinate differencesy - xandz - xare whole numbers: every integer point (the origin included), and the whole(1, 1, 1)line through each of them ((t, t, t)among them). On that set values change by up to 0.776; for examplesnoise(0, 0, 0)was -0.4358730 and is 0,snoise(5, 0, 0)was 0.7076616 and is 0.671713, andsnoise(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. The cell offset is computed in float32, so an input whose differencesy - xandz - xround, in float32, onto whole numbers can tie and change too. How far from the set that reaches scales with the coordinates' magnitude: a few float32 ulps of the largest coordinate (a probe over random inputs found changed inputs up to about two ulps away; measured, not proved). Computed coordinates such asi * 0.1fcan land there, so near large coordinates the band is wide. Elsewhere the results are bit-identical to 0.3.0 (SnoiseTieScopeTests, goldens computed by the 0.3.0 DLL).snoiseis 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 content sampled on a whole-number grid) changes; regenerate it when you take this version.
Added
- Interval arithmetic on
float2(lo, hi):math.iv_point,iv_add,iv_sub,iv_mul,iv_neg,iv_scale,iv_abs,iv_min,iv_max,iv_clamp,iv_saturate,iv_lerp,iv_sqr,iv_sqrt,iv_exp,iv_smoothstep,iv_snoise_ball(float3andfloat2centres),iv_fbm_ballandiv_frustum_ball, with the HLSL mirrors in the newShaders/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)onSNOISE_LIPSCHITZ,iv_fbm_ballon the same constant throughiv_snoise_ball(float3),iv_snoise_ball(float2)onSNOISE2_LIPSCHITZ, andaf_snoiseonSNOISE_HESSIANandSNOISE_LIPSCHITZ, whichaf_fbmreaches throughaf_snoise.iv_frustum_ballandaf_frustum_ballread no noise constant: they are geometry plus a 2^-20 rounding widening, and they return a ball (float4) to hand to a noise call, which carries the constant. 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,af_frustum_axisandaf_frustum_ball, with the HLSL mirrors in the newShaders/CultMath.Affine.hlsl. - Noise bound constants
math.SNOISE_LIPSCHITZ,SNOISE2_LIPSCHITZandSNOISE_HESSIAN: empirical bounds with a margin, re-measured and pinned byNoiseBoundTests. math.asfloat(uint), the inverse ofmath.asuint.BoundedLeastSquares.Solveoverload takingkktRelativeTolerance, and the constantBoundedLeastSquares.DefaultKktRelativeTolerance(1e-6). The tolerance must be finite and greater than zero, else the result isInvalidInput. The overload without it passes the default and returns the same result as before.
Fixed
- The NuGet package
GameCult.Mathnow carriesCultMath.Affine.hlslundercontentFiles/any/any/shaders, as the README says it does.
[0.3.0]
Breaking
math.snoise(float3)andmath.snoise(float2), and their HLSL mirrorscultmath_snoise, return different values. The kernel now follows stegu/webgl-noise. For 3D only, the falloffr^2constant is 0.5 (was 0.6) and the output scale is 105 (was 42). For 2D, the falloff constant (0.5) and the output scale (130) are unchanged. In both, the shared permutation offset is now +10 (was +1), which changes the values of both. This removes the value discontinuities the 3D kernel had at simplex cell boundaries. Any content seeded fromsnoisechanges; regenerate it when you take this version.
Added
math.smin_grad: smooth minimum with gradient, forfloat4operands carrying the gradient inxyzand the value inw.math.cellularand theCultCellularresult struct: cellular (Worley) noise returning the gradient and distance to the nearest feature points.math.snoise_grad,math.fbm_gradandmath.ridged_grad: simplex noise, fractal Brownian motion and ridged multifractal with analytic gradients, returned asfloat4with the gradient inxyzand the value inw.math.phacelleand theCultPhasorresult struct: Phacelle noise with gradient.math.Phacelle.cs,CultPhasor.csandShaders/CultMath.Phacelle.hlslare MPL-2.0 (seeTHIRD-PARTY-NOTICES.md).BoundedLeastSquares: an allocation-free, deterministic bounded least-squares solver (Solve) with a status result and the input contract documented on the type.- The matching
cultmath_*HLSL mirrors of the functions above inShaders/CultMath.hlslandShaders/CultMath.Phacelle.hlsl.
[0.2.4]
Added
math.erfandmath.erfinv: single-precision error function and its inverse.erfis the Abramowitz & Stegun 7.1.26 rational/exponential fit (max absolute error 1.5e-7 by that source, 6.621e-7 measured here against an independent reference).erfinvis Giles' minimax polynomial ("Approximating the erfinv function", GPU Computing Gems, 2010), guarded explicitly at the domain edges (erfinv(1) = +Infinity,erfinv(-1) = -Infinity, outside[-1, 1]isNaN); measured worst absolute error 5.066e-7, worsterf(erfinv(y))round trip 6.109e-7.