CultMath: document phacelle and record Johansen's MPL-2.0 provenance
design.md names CultPhasor as the second struct-return consumer and describes phacelle (stripe wave vector, weight, normalization, exact gradient and its two discontinuity classes, exact pruning). THIRD-PARTY-NOTICES.md, in both the package root and the Unity package, cites Rune Skovbo Johansen's Phacelle Noise (MPL-2.0) and records that the 3D-cell generalisation, the caller-supplied side vector, the exact gradient and the exact pruning are new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7904e15ed3
commit
9f18a432cb
3 changed files with 51 additions and 2 deletions
|
|
@ -19,3 +19,18 @@ permutation and scale as `snoise(float3)`.
|
|||
- Copyright 2011 Ashima Arts.
|
||||
- Upstream: <https://github.com/ashima/webgl-noise>
|
||||
- License: MIT.
|
||||
|
||||
## Phacelle Noise
|
||||
|
||||
`math.phacelle` and `cultmath_phacelle` follow Rune Skovbo Johansen's Phacelle
|
||||
noise (Shadertoy `t3dyWl`; erosion filter `wXcfWn`; blog, March 2026), read
|
||||
from the C# port `PhacelleNoise` in `lpmitchell/AdvancedTerrainErosion`
|
||||
(`AdvancedTerrainErosion.cs`, converted to burstable C# by Luke Mitchell,
|
||||
2026). The cell weight, the phase blend and the normalization follow it. The
|
||||
3D-cell generalisation, the caller-supplied stripe wave vector, the exact
|
||||
gradient and the exact pruning are new here.
|
||||
|
||||
- Copyright (c) 2025 Rune Skovbo Johansen.
|
||||
- Upstream: <https://github.com/lpmitchell/AdvancedTerrainErosion>
|
||||
- License: MPL-2.0 (<https://mozilla.org/MPL/2.0/>). CultMath's Unity package
|
||||
is MPL-2.0, so the licence is compatible.
|
||||
|
|
|
|||
|
|
@ -128,8 +128,8 @@ whose HLSL return type is a plain struct of `float`/`floatN`/`int`/`intN`
|
|||
fields is compared to its C# counterpart field by field, recursing into each
|
||||
field's own components, down to bit-for-bit scalars, matching each leaf's
|
||||
declaration path (field names, not just position) and declared type as well
|
||||
as its value. `CultCellular` (`math.cs`, `cellular`) is the first and, for
|
||||
now, only consumer. A struct return with a mismatched, reordered-by-name, or
|
||||
as its value. `CultCellular` (`math.cs`, `cellular`) and `CultPhasor`
|
||||
(`math.cs`, `phacelle`) are its consumers. A struct return with a mismatched, reordered-by-name, or
|
||||
retyped field does not get a second comparison path or a shape of its own;
|
||||
it fails the same walk that already handles a bare vector return.
|
||||
|
||||
|
|
@ -264,6 +264,25 @@ together, laid out as `float4(gradient.xyz, value.w)`, with no value-only twin
|
|||
which is the right domain for `pcg3d`/`pcg4d`'s O(1) hash inputs but would
|
||||
turn an unclamped octave count into a multi-billion-iteration loop for these
|
||||
two mirrors.
|
||||
- `phacelle(float3 p, float3 side, float offset, float normalization)` is Rune
|
||||
Skovbo Johansen's Phacelle noise ("phase + cell": a stripe pattern built by
|
||||
blending one cosine/sine wave per jittered cell), generalised to 3D cells. It
|
||||
returns `CultPhasor { cos, sin }`, each `(∇, value)`. `side` is the stripe
|
||||
wave vector, whose length is 2π times the stripe frequency; in 3D the
|
||||
perpendicular to the flow is not unique, so the caller chooses it (on a unit
|
||||
sphere, `cross(p̂, flow)`). `offset` is the phase in cycles. It visits 4×4×4
|
||||
cells with `pcg3d`-hashed jitter in `[-0.5, 0.5)`, weights each wave by
|
||||
`max(0, exp(-2d²) - 0.01111)`, and normalizes the blended phasor as upstream
|
||||
does (length 1 where the raw length is at least `1 - normalization`, scaled
|
||||
by `1 / (1 - normalization)` below). The gradient is exact, weight
|
||||
derivatives and normalization included, rather than upstream's
|
||||
`∇cos ≈ -sin·side`, which ignores the weight gradient. It is discontinuous
|
||||
where the raw length crosses the normalization threshold and where a cell's
|
||||
weight leaves its support (distance 1.4998); the value is continuous at both.
|
||||
Cells whose per-axis lower bound `Σ max(0, |local - g| - 0.5)²` is at least
|
||||
2.25 have weight exactly 0 and are skipped, which changes no output bit;
|
||||
`PhacelleTests` pins that against an internal overload with the prune
|
||||
disabled. No 2D variant exists; nothing consumes one.
|
||||
|
||||
Integer hashing uses the PCG hashes from Jarzynski and Olano, "Hash Functions
|
||||
for GPU Rendering" (JCGT 9(3), 2020): `pcg(uint)` is O'Neill's RXS-M-XS 32/32
|
||||
|
|
|
|||
|
|
@ -19,3 +19,18 @@ permutation and scale as `snoise(float3)`.
|
|||
- Copyright 2011 Ashima Arts.
|
||||
- Upstream: <https://github.com/ashima/webgl-noise>
|
||||
- License: MIT.
|
||||
|
||||
## Phacelle Noise
|
||||
|
||||
`math.phacelle` and `cultmath_phacelle` follow Rune Skovbo Johansen's Phacelle
|
||||
noise (Shadertoy `t3dyWl`; erosion filter `wXcfWn`; blog, March 2026), read
|
||||
from the C# port `PhacelleNoise` in `lpmitchell/AdvancedTerrainErosion`
|
||||
(`AdvancedTerrainErosion.cs`, converted to burstable C# by Luke Mitchell,
|
||||
2026). The cell weight, the phase blend and the normalization follow it. The
|
||||
3D-cell generalisation, the caller-supplied stripe wave vector, the exact
|
||||
gradient and the exact pruning are new here.
|
||||
|
||||
- Copyright (c) 2025 Rune Skovbo Johansen.
|
||||
- Upstream: <https://github.com/lpmitchell/AdvancedTerrainErosion>
|
||||
- License: MPL-2.0 (<https://mozilla.org/MPL/2.0/>). CultMath's Unity package
|
||||
is MPL-2.0, so the licence is compatible.
|
||||
|
|
|
|||
Loading…
Reference in a new issue