@vitreajs/vitrea 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1638,6 +1638,33 @@ interface MaterialRim {
1638
1638
  * occlusion over 142,550 pixels on the finest cell, and the same three lengths
1639
1639
  * describe every profile, backdrop, span and scale in the bed.
1640
1640
  *
1641
+ * ## Two terms on ONE falloff (W14 G0, claims §5.62)
1642
+ *
1643
+ * The description above holds where W8 measured it and misses two things the bed
1644
+ * has since shown, both of which live in the AMPLITUDE and neither of which
1645
+ * moves a length. Outside the coverage, in the compositing (encoded) domain:
1646
+ *
1647
+ * out = bg · (1 − α_b(backdrop, span) · F(d)) + A_v(span) · F(d) · V
1648
+ *
1649
+ * with **one** falloff `F` — W8's own, at 15.55 / 7.95 / 3.1, re-read free and
1650
+ * unmoved on both terms (σ 14.8–16.2 and offset 7.93–8.00 for the black term,
1651
+ * σ 14.1–17.1 and offset 7.6–8.4 for the lift) — and `V` the backdrop's own
1652
+ * light blurred at `liftBlurSigmaCss`.
1653
+ *
1654
+ * The first term's amplitude ADAPTS below the knee: the reference's fill alpha
1655
+ * is 0.33 over the mid backdrops, 0.127 over `light-solid` and nothing over
1656
+ * black, keyed on the SAME backdrop luminance statistic W9's face response uses
1657
+ * (the ENCODED-space mean, decoded — `backdropToneAnchorX`'s own axis), through
1658
+ * the same thickness curve that gates that regime. Above the knee it is the
1659
+ * composite's transmission by span. The second term is the lift, GPU-tier only,
1660
+ * and it is exactly zero below the knee and exactly zero over black, so the
1661
+ * facet's "invisible over a black backdrop" property survives both terms.
1662
+ *
1663
+ * The layer tree's `inputShadowAmount` and `inputShadowHeight` are NOT either
1664
+ * term's spatial extent — the charter's advisory was wrong there, and G0's free
1665
+ * fits overturned it. Only `inputShadowBlurRadius` 40 belongs to the lift, as
1666
+ * the blur of the backdrop it copies.
1667
+ *
1641
1668
  * **Multiplicative, and not additively.** Mirrored pixel pairs either side of a
1642
1669
  * capsule over the `photo` backdrop see the same shadow over different backdrop
1643
1670
  * luminances: the darkening's ratio tracks the backdrop's ratio to 4.5% while a
@@ -1666,22 +1693,151 @@ interface MaterialOuterShadow {
1666
1693
  /** Outward spread of the silhouette before the blur, CSS px. */
1667
1694
  readonly spreadPx: number;
1668
1695
  /**
1669
- * Peak occlusion: the fraction of the backdrop's own LINEAR light removed deep
1670
- * inside the shadow. Zero stands the whole facet down, pad and all.
1696
+ * The black term's peak occlusion below the knee, over a backdrop the material
1697
+ * cannot see (linear luminance ≤ `OUTER_SHADOW_THIN_L.inert`): zero. Inert
1698
+ * over `dark-solid` and `impulse`, which is what the reference does — it
1699
+ * removes at most one or two of 255 codes there (claims §5.62 §5).
1700
+ */
1701
+ readonly thinOcclusionDark: number;
1702
+ /**
1703
+ * The black term's peak occlusion below the knee over the MID plateau —
1704
+ * backdrop linear luminance `OUTER_SHADOW_THIN_L.midFrom` … `midTo`.
1705
+ *
1706
+ * MEASURED (claims §5.62 §5): linear occlusion 0.347 over `mid-dark-solid`,
1707
+ * 0.334–0.339 over `photo`, 0.327–0.328 over the checkerboard and 0.329 over
1708
+ * `hc-text` — flat across a backdrop luminance range of 0.06…0.74, and a
1709
+ * constant 1.16–1.19× the fill alpha §5.50 §2 read off the layer tree.
1710
+ */
1711
+ readonly thinOcclusionMid: number;
1712
+ /**
1713
+ * The black term's peak occlusion below the knee over a BRIGHT backdrop, at
1714
+ * `OUTER_SHADOW_THIN_L.bright` and above.
1715
+ *
1716
+ * MEASURED (claims §5.62 §5): 0.127 over `light-solid` (linear luminance
1717
+ * 0.891), against the layer tree's tabulated 0.05 — so the reference's shadow
1718
+ * there is 0.39 of its shadow over the checkerboard, not one sixth. W8's
1719
+ * single 0.285 everywhere is 2.24× this, which is the whole of the user's
1720
+ * by-eye "the shadow is darker on the light-solid capsule" and, by the free
1721
+ * geometry fit on that cell (σ 14.81 / offset 7.97 / spread 3.17), no part of
1722
+ * it is shape.
1671
1723
  */
1672
- readonly occlusion: number;
1724
+ readonly thinOcclusionBright: number;
1673
1725
  /**
1674
- * What reduced transparency does to `occlusion` — MEASURED, not assumed, which
1675
- * is what the charter asked for before the fold was written.
1726
+ * The COMPOSITE occlusion above the knee at a casting span of 96 CSS px.
1727
+ *
1728
+ * FITTED in the renderer (claims §5.65), from G0's measurement of the
1729
+ * composite's transmission (0.379 on the checkerboard at span 96) to **0.370**.
1730
+ * It had to be fitted rather than adopted, because what G0 could identify at
1731
+ * the bed's noise floor is the composite transmission and the lift's peak
1732
+ * amplitude, not the split into (black alpha, vibrant alpha, vibrant colour):
1733
+ * both terms ride one falloff and their shapes correlate at 0.9998. So this
1734
+ * constant is the BLACK term of a two-term composite whose second term
1735
+ * (`liftAmplitude`) was fitted beside it, on X7's affine pair, and the pair is
1736
+ * what the referee reads.
1737
+ */
1738
+ readonly thickOcclusionAt96: number;
1739
+ /** The same at a casting span of 128 CSS px — FITTED to 0.448 from G0's
1740
+ * measured 0.497, for `thickOcclusionAt96`'s reason (claims §5.65). */
1741
+ readonly thickOcclusionAt128: number;
1742
+ /**
1743
+ * The same at a casting span of 160 CSS px — **UNFITTED**, and the one anchor
1744
+ * in this block that no calibration cell reaches.
1745
+ *
1746
+ * Every span above 128 in the bed is holdout, so 0.479 is carried by the stated
1747
+ * derivation from the two fitted anchors and not by a fit. The holdout, read
1748
+ * once and fitted to nothing, says it is 15% heavy (band `1 − a` 0.2436 against
1749
+ * the reference's 0.2117) and implies about 0.437 — which is BELOW the fitted
1750
+ * At128 and which no extrapolation from the calibration cells would have
1751
+ * produced. That reading is recorded and deliberately not adopted (claims §5.65
1752
+ * §4(b) and §6(iv)); closing it needs a calibration cell above span 128.
1753
+ */
1754
+ readonly thickOcclusionAt160: number;
1755
+ /**
1756
+ * **The lift (W14)** — the peak amplitude of the second term, in LINEAR light,
1757
+ * as a fraction of the backdrop's own blurred luminance. GPU tier only.
1676
1758
  *
1677
- * The reference's shadow under `reduce transparency` is the same shadow at
1678
- * 0.566 of the amplitude: 0.1830/0.3259, 0.1884/0.3309 and 0.1882/0.3314 on the
1679
- * three structured backdrops at a 44 px span, with σ, offset and spread
1680
- * unmoved. It does not vanish and it does not intensify.
1759
+ * The reference's thick shadow does not only remove light: on the
1760
+ * checkerboard's black squares, where a multiply is inert by construction, it
1761
+ * ADDS 7.4 of 255 (claims §5.62 §2). Pooled over six backdrops the addition
1762
+ * regresses on the σ-40 blurred backdrop at slope 0.0444 with intercept
1763
+ * −0.0042 and R² 0.983 — it is the backdrop's own light, blurred, composited
1764
+ * under the shadow, with no fixed colour left over. Zero over `impulse`, zero
1765
+ * over `dark-solid`, and zero below the knee, so the facet stays exactly inert
1766
+ * over black the way W8's multiply is.
1767
+ *
1768
+ * FITTED to **0.0100** in the renderer over seventeen sweep passes, read on
1769
+ * X7's affine pair together with the three thick anchors (claims §5.65). The
1770
+ * provisional 0.0073 was G0's +0.0038 of LINEAR lift at span 160 divided by
1771
+ * the ≈ 0.52 linear luminance the checkerboard's σ-40 blur sits at, and the fit
1772
+ * is 37% larger. The space matters and this wave names it everywhere (claims
1773
+ * §5.62 §3): §5.60's +0.039 is the same lift read in ENCODED luma.
1774
+ */
1775
+ readonly liftAmplitude: number;
1776
+ /**
1777
+ * Where the lift starts, in casting span, CSS px — the thin/thick knee, and it
1778
+ * is exact: the lift reads 0.0000 at spans 32 and 44 and is present at 96
1779
+ * (claims §5.62 §2). The layer tree's own `VibrancyContribution` clamps from
1780
+ * the same 64.
1781
+ */
1782
+ readonly liftSpanMin: number;
1783
+ /**
1784
+ * Where the lift saturates, in casting span, CSS px.
1785
+ *
1786
+ * FITTED to **118** (claims §5.65), from a provisional 128. The measured rise
1787
+ * is 0.52 / 0.96 / 1.00 of the span-160 value at spans 96 / 128 / 160, against
1788
+ * the layer tree's clamp((span − 64)/96) = 0.33 / 0.67 / 1.00 — so the lift is
1789
+ * NOT proportional to `VibrancyContribution`; it rises and saturates, reaching
1790
+ * 96% by span 128 (claims §5.62 §2), which a smoothstep from `liftSpanMin`
1791
+ * reproduces and the clamp does not. The holdout says the reach saturates a
1792
+ * little early — the lift's own residual there is one-signed and small, 5% low
1793
+ * at span 130 and 9% at 160 (claims §5.65 §4(d)) — and it was not refitted
1794
+ * after that reading.
1795
+ */
1796
+ readonly liftSpanFull: number;
1797
+ /**
1798
+ * The σ, in CSS px, of the blur the lift copies the backdrop through.
1799
+ *
1800
+ * MEASURED at 40 ± 8 CSS px on `rrect-lg` at both scales and in two rings, by
1801
+ * the probes' pitch axis — the pooled residual has a real minimum there, 12%
1802
+ * below the flat-copy residual (claims §5.62 §3). It is the layer tree's
1803
+ * `inputShadowBlurRadius` 40 read as a Gaussian standard deviation. NOT
1804
+ * identifiable on the mid spans (flat to 0.7%), and reported as such rather
1805
+ * than fitted there.
1806
+ */
1807
+ readonly liftBlurSigmaCss: number;
1808
+ /**
1809
+ * The shadow's amplitude UNDER reduced transparency — one absolute linear
1810
+ * occlusion that replaces both regimes, not a factor on either. MEASURED,
1811
+ * which is what the charter asked for before the fold was written.
1812
+ *
1813
+ * **0.197 (measured 0.192–0.202).** W14 G0 read the preference on the wider
1814
+ * bed and what it found is a flat number: the reference's exterior is
1815
+ * 0.192–0.202 under increased contrast and reduced transparency alike, **thin
1816
+ * and thick together** and over every backdrop it can be read on (claims §5.62
1817
+ * §5). The preference removes the material's adaptation, so the shadow it
1818
+ * leaves has neither the thin regime's backdrop keying nor the thick regime's
1819
+ * span law in it — one amplitude for every surface over every backdrop, which
1820
+ * is what `outerShadowUnderPolicy` writes into all six anchors. The lift goes
1821
+ * with it: a composite whose two regimes read the same number has no second
1822
+ * term left in it.
1823
+ *
1824
+ * It is stated as an ABSOLUTE occlusion rather than as a ratio because W8's
1825
+ * 0.70 multiplier was fitted when the amplitude was one span-flat number and a
1826
+ * ratio was the same thing as a level. It is not any more: multiplying six
1827
+ * unequal anchors keeps exactly the backdrop and span variation the preference
1828
+ * removes, and a span-160 surface over a mid-tone backdrop folded to 0.38
1829
+ * against the reference's 0.20. The number the reference states is a level, so
1830
+ * this constant is a level.
1831
+ *
1832
+ * Nothing is special-cased for a dark backdrop and nothing needs to be: an
1833
+ * occlusion is a fraction of the backdrop's own light, so a flat 0.197 over
1834
+ * black still removes nothing, and the facet stays as inert there as the thin
1835
+ * regime's own zero anchor makes it without the preference.
1681
1836
  *
1682
1837
  * The `increased contrast` reference reproduces the reduced-transparency
1683
- * amplitude to four decimals (0.1830, 0.1884, 0.1882 — the same numbers), which
1684
- * is Decision Log 8's finding again: macOS force-couples the two toggles, so the
1838
+ * amplitude to four decimals (0.1830, 0.1884, 0.1882 on the three structured
1839
+ * backdrops at a 44 px span, with σ, offset and spread unmoved), which is
1840
+ * Decision Log 8's finding again: macOS force-couples the two toggles, so the
1685
1841
  * contrast reference IS the reduced-transparency state and the bed cannot
1686
1842
  * separate them. The fold therefore keys on `frost`, the axis reduced
1687
1843
  * transparency alone sets, rather than on the contrast axes it would be
@@ -1751,8 +1907,9 @@ interface MaterialProfile {
1751
1907
  * on it — the lens (`lensSizeGainMax`), the occlusion (`sizeOcclusionGain`)
1752
1908
  * and the inner shadow (`sizeShadowGainMax`). The scattering was one of them
1753
1909
  * until W11c measured its curve to be a different one (a floor at small
1754
- * spans, a band top past 96 — see `sizeScatterFloor`); it now rides its own,
1755
- * from the same `sizeSpanMin`, and this band is untouched by it.
1910
+ * spans, a rise past 96) and W13 measured that curve to be the projection of a
1911
+ * ramp in depth — see `sizeScatterFloor` and `sizeScatterRampStartThin1x`; the
1912
+ * scattering now rides its own law entirely, and this band is untouched by it.
1756
1913
  *
1757
1914
  * A smoothstep rather than a straight ratio, so two surfaces of nearly the same
1758
1915
  * size never read as differently thick, and so every gain saturates instead of
@@ -1770,12 +1927,17 @@ interface MaterialProfile {
1770
1927
  readonly sizeSpanMin: number;
1771
1928
  readonly sizeSpanMax: number;
1772
1929
  /**
1773
- * The lens's gain on the size curve — "more pronounced lensing and refraction".
1930
+ * The inner shadow's depth gain on the size curve — and, until W12 G2, the
1931
+ * lens's too.
1774
1932
  *
1775
- * `lensDepthPx` is `thickness × lensSizeGain(span)`, clamped to the shorter
1776
- * *half* extent. The clamp is what keeps a small control from being all lens: a
1777
- * 24 px-tall button cannot bend more than 12 px of backdrop however thick it is
1778
- * authored.
1933
+ * The inner shadow's depth is `thickness × (1 + (lensSizeGainMax − 1) ×
1934
+ * sizeThickness)`, clamped to the shorter *half* extent, and its profile is
1935
+ * `(1 − depth)²` on that depth: the landed law of W2, kept byte-for-byte for the
1936
+ * occlusion because nothing measured it as wrong. The LENS no longer reads it —
1937
+ * the reference's own lens height is a clamped linear function of the span
1938
+ * (`lensHeightPerSpan`, `lensHeightMax`), read straight from its layer tree
1939
+ * (claims §5.50), and the lens takes that law from W12 G2 on. The name stays so
1940
+ * the profile documents keep naming the constant they measured.
1779
1941
  */
1780
1942
  readonly lensSizeGainMax: number;
1781
1943
  /**
@@ -1799,37 +1961,329 @@ interface MaterialProfile {
1799
1961
  * chain level whose blur is that σ.
1800
1962
  *
1801
1963
  * MEASURED (W11c G1, claims §5.41), and no longer a gain on `sizeThickness`
1802
- * alone — see `sizeScatterFloor` and `sizeScatterSpanMax` below for the curve
1803
- * it rides. 8: the heavy component of the reference's interior sits near σ 10
1804
- * CSS px against a body σ of 1.25, and the gain sweep has a clear minimum at
1805
- * 8 (RMS 0.0164 against 0.0180 at 6 and 0.0191 at 10 on the probe bed).
1964
+ * alone — see `sizeScatterFloor` and `sizeScatterRampStartThin1x` below for the
1965
+ * law it rides. 8: the heavy component of the reference's interior sits near
1966
+ * σ 10 device px against a body σ of 1.25, and the gain sweep has a clear
1967
+ * minimum at 8 (RMS 0.0164 against 0.0180 at 6 and 0.0191 at 10 on the probe
1968
+ * bed).
1806
1969
  */
1807
1970
  readonly sizeScatterGainMax: number;
1808
1971
  /**
1809
- * **The scattering facet's own curve** (W11c G1, claims §5.41).
1972
+ * **The scattering facet's frost** (W11c G1, claims §5.41; re-read by W13 G1).
1810
1973
  *
1811
1974
  * The reference's interior over structured content is two components, read
1812
1975
  * off the W9 probe bed across four checkerboard pitches and five spans: a
1813
- * sharp one near σ 1.25 CSS px and a heavy one near σ 10, mixed by a share
1814
- * that is already ≈ 0.4 at spans of 32–44 and still rising at 160 (0.52 at
1815
- * 96, 0.64 at 128, 0.76 at 160). `sizeThickness` — zero at `sizeSpanMin` and
1816
- * saturated at `sizeSpanMax` = 96 — can express neither the floor nor a band
1817
- * top past 96, and moving `sizeSpanMax` would move the lens, the occlusion,
1818
- * the inner shadow and W9's thin/thick response rows with it. So the scatter
1819
- * mix rides its own curve:
1976
+ * sharp one near σ 1.25 device px and a heavy one near σ 10, mixed by a share
1977
+ * that is already ≈ 0.4 at spans of 32–44 and still rising at 160. W11c
1978
+ * carried that mix as one number per span, a floor rising by a smoothstep to
1979
+ * a band top (`sizeScatterSpanMax`); W13 G0 measured the mix **per depth** on
1980
+ * both probes and found a ramp under the contour that the span law had been
1981
+ * summarising (claims §5.61 §2). W13 G1's first form replaced the span law
1982
+ * with the ramp outright and its runtime sweep refuted that: the ramp's own
1983
+ * projection onto one number per surface runs 0.43–0.56 where the span law it
1984
+ * replaced runs 0.41–1.00, so a ramp with a start and a reach is nearly
1985
+ * span-flat where the bed is strongly span-graded, and no point in 81 reached
1986
+ * the wave's stops (`results/2026-09-03-w13-ramp/g1/sweep/g1-sweep.md` §4,
1987
+ * §7). So the two are kept **together**: the span law is the ramp's DEEP
1988
+ * value and the ramp is a near-contour excursion above it. This floor is
1989
+ * unchanged in value and in meaning under either: the mix a surface carries
1990
+ * at any size, the material's own frost.
1991
+ *
1992
+ * It keeps its fold semantics, and they are now written on the ramp rather
1993
+ * than on a span curve:
1820
1994
  *
1821
1995
  * ```
1822
- * kScatter = floor + (1 − floor) · smoothstep(sizeSpanMin, sizeScatterSpanMax, span) · fold
1996
+ * kScatter(u) = floor + (k(u) − floor) · fold
1823
1997
  * ```
1824
1998
  *
1825
- * The floor is the material's own frost and is **not** folded under an
1826
- * accessibility preference; the span-dependent rise is a depth effect and
1827
- * folds like every other facet (`scatterThickness`). Fitted with `rrect-lg`
1828
- * held out: floor 0.40 (0.0175 at 0.3, 0.0174 at 0.45), band top 256 (0.0182
1829
- * at 224, 0.0174 at 320); the held-out cell's residual 0.0366 → 0.0174.
1999
+ * — so at fold 1 the ramp is rendered exactly and at fold 0 the material sits
2000
+ * at this floor exactly, which is what the landed law did at fold 0 too. The
2001
+ * floor is the frost the material has whatever its size, and is **not**
2002
+ * folded under an accessibility preference; the excursion away from it is
2003
+ * depth, and is. Fitted with `rrect-lg` held out (W11c G1): 0.40 (0.0175 at
2004
+ * 0.3, 0.0174 at 0.45).
1830
2005
  */
1831
2006
  readonly sizeScatterFloor: number;
2007
+ /**
2008
+ * **The scattering facet's span curve** (W11c G1, claims §5.41) — the top of
2009
+ * the band the frost rises to, and, since W13 G1's re-forming, the span law
2010
+ * that supplies the depth ramp's DEEP value:
2011
+ *
2012
+ * ```
2013
+ * kDeep(span) = floor + (1 − floor) · smoothstep(sizeSpanMin, sizeScatterSpanMax, span)
2014
+ * ```
2015
+ *
2016
+ * — byte for byte the curve W11c fitted and W13 G1's first form retired. It
2017
+ * came back because the sweep measured what retiring it cost (§4 of
2018
+ * `results/2026-09-03-w13-ramp/g1/sweep/g1-sweep.md`): the span dependence of
2019
+ * the bed is real and strong, and the ramp's four constants cannot carry it
2020
+ * at the same time as the band's near-contour excursion. What the ramp adds
2021
+ * is what this curve never could — the depth structure inside one surface —
2022
+ * and it now adds it on top of this rather than instead of it, so the deep
2023
+ * interior of every span is exactly where W11c and W12 put it.
2024
+ *
2025
+ * `sizeThickness` — zero at `sizeSpanMin` and saturated at `sizeSpanMax` = 96
2026
+ * — can express neither the floor nor a band top past 96, and moving
2027
+ * `sizeSpanMax` would move the lens, the occlusion, the inner shadow and W9's
2028
+ * thin/thick response rows with it, which is why the scatter mix has its own
2029
+ * curve at all. Fitted with `rrect-lg` held out (W11c G1): band top 256
2030
+ * (0.0182 at 224, 0.0174 at 320); the held-out cell's residual 0.0366 →
2031
+ * 0.0174.
2032
+ */
1832
2033
  readonly sizeScatterSpanMax: number;
2034
+ /**
2035
+ * **The body's second scale** (W15 G1, from the measurement of claims §5.69
2036
+ * §1–§2) — the heavy width's gain, the deep value's floor and the deep
2037
+ * value's span top, each read again at dpr 2.
2038
+ *
2039
+ * At 2x the reference's body is a different object from the one the three
2040
+ * constants above describe, and §5.69 measured all of it: the deep interior
2041
+ * is FULLY heavy on the two largest spans and 0.90–0.95 heavy on `rrect-md`
2042
+ * (§2), where the 1x span curve leaves a sharp share of 0.24–0.36 there, and
2043
+ * the heavy component's own width is 8–11 device px against the 1x law's 10
2044
+ * CSS px (§1). One curve fitted at 1x cannot be both, so the deep value's two
2045
+ * constants and the gain get a second reading rather than a scale factor —
2046
+ * the same shape the ramp's anchors already have.
2047
+ *
2048
+ * Each is interpolated by `rampAtScale`: held at the 1x constant at dpr ≤ 1,
2049
+ * at this one from dpr 2 up, linear between. **At dpr 1 every one of them is
2050
+ * inert by construction, whatever it says** — W15's binding rule — so the 1x
2051
+ * material is byte-identical to the W13 bed and the landing's confirmation
2052
+ * measured exactly that: 49 of 49 1x GPU cells identical to the bed with
2053
+ * every capture byte-identical (claims §5.70 §8).
2054
+ *
2055
+ * Consumed at draw time, not folded into a constant: `scatterDeepThickness`
2056
+ * takes the ratio for the floor and the span top, the renderer resolves all
2057
+ * three from the viewport's own ratio and hands them to the optics pass
2058
+ * through the uniforms the shader already reads (`scatter.x`, `lensOval.w`
2059
+ * and `size.x`), and `scatterThickness`, `scatterSharpShare` and the ramp's
2060
+ * area-average projection read the resolved deep value.
2061
+ *
2062
+ * **FITTED** by W15 G1's runtime sweep at
2063
+ * `--profile apple-macos-26.5-2x-light-standard` on the calibration set, the
2064
+ * holdout untouched, and landed at the values below (claims §5.70 §2 and §8;
2065
+ * the four sweeps `results/2026-09-04-w15-body-2x/g1/stage1..stage3` and the
2066
+ * confirmation `confirm-3`, whose 2x holdout was read once for this
2067
+ * configuration). The rule W13 wrote after the paper model over-credited the
2068
+ * mip chain's heavy tap (§5.58 §1) held: no constant here lands on a paper
2069
+ * prediction, and the sweep contradicted the paper estimate.
2070
+ *
2071
+ * **The gain, 4.8.** Stage 2c swept it over 4.0 / 4.4 / 4.8 / 5.2 at the
2072
+ * chosen base and found an INTERIOR MINIMUM at 4.8 — the interior spread
2073
+ * against native reading 0.0335 / 0.0214 / 0.0120 / 0.0217 with the band's
2074
+ * rise at its top too. Through `bodySigmaCssFor` that is a heavy width of
2075
+ * **6 device px** at dpr 2, NARROWER than the 8–11 device px §5.69 §1
2076
+ * bounded as a Gaussian: the estimator carries ±40% on a real capture of a
2077
+ * known law (§5.69 §3) and the mip chain's tap is not a Gaussian, so the
2078
+ * renderer is the fitting instrument and 6 is the width it draws best.
2079
+ *
2080
+ * **The floor, 1.0** — the deep value FULLY heavy at dpr 2, which is what
2081
+ * G0's deep windows read on the two largest spans (§5.69 §2). `kDeep` is
2082
+ * therefore 1 at every span at this ratio, and the depth ramp above it is the
2083
+ * whole body (§5.70 §1).
2084
+ *
2085
+ * **The span top, 256** — the 1x value, unchanged, because a floor of 1
2086
+ * leaves the deep value nothing to rise to and the top has no work at this
2087
+ * ratio. Stage 1 swept it against 128 and the bed did not ask for the change.
2088
+ */
2089
+ readonly sizeScatterGainMax2x: number;
2090
+ readonly sizeScatterFloor2x: number;
2091
+ readonly sizeScatterSpanMax2x: number;
2092
+ /**
2093
+ * **The heavy width's gain at the TOP of the scatter span curve, at dpr 2**
2094
+ * (W15 G1's re-form, from claims §5.70 §4 and §7 and the measurement of
2095
+ * §5.69 §1) — the second-scale term that lets the 2x heavy width GROW with
2096
+ * the span instead of being one number for the whole bed.
2097
+ *
2098
+ * `sizeScatterGainMax2x` above is one gain at dpr 2, and the sweep that fitted
2099
+ * it read the calibration cells, whose spans are 32–128. The reference's heavy
2100
+ * kernel is not one width: §5.69 §1's bounded per-span fit reads 8.0 / 7.5 /
2101
+ * 8.0 / 9.0 / 11.0 device px across the bed's spans, a ratio of 1.375 between
2102
+ * span 160 and span 96. Landing the single gain accordingly left the largest
2103
+ * span's deep interior about 40% too structured (`rrect-lg` at 2x, spread
2104
+ * 0.1134 against the reference's 0.0810, claims §5.70 §4) while every smaller
2105
+ * cell rose. So the gain takes a second grading, in SPAN:
2106
+ *
2107
+ * ```
2108
+ * gain(span, dpr) = gainAtScale(dpr)
2109
+ * + (gainFar(dpr) − gainAtScale(dpr))
2110
+ * · smoothstep(sizeSpanMax, sizeScatterSpanMax(dpr), span)
2111
+ * ```
2112
+ *
2113
+ * with `gainAtScale` the existing `scatterGainAtScale` and `gainFar` this
2114
+ * constant interpolated by `rampAtScale` from `sizeScatterGainMax`. The curve
2115
+ * is not a new span statistic: it is the same smoothstep the fourth form's
2116
+ * far-anchor decline already rides (`scatterRampStart`), so the width and the
2117
+ * ramp's start move along one curve above the thickness knee.
2118
+ *
2119
+ * **Inert at dpr 1 by construction.** `gainFar` interpolates from
2120
+ * `sizeScatterGainMax` — the 1x gain, not this constant — so at dpr ≤ 1 the
2121
+ * far gain IS the base gain and the whole term is a flat no-op whatever this
2122
+ * says. That is W15's binding rule (the 1x material does not move) discharged
2123
+ * by the shape of the formula rather than by a capture.
2124
+ *
2125
+ * **LANDED at 9.9** (claims §5.70 §8; W15 Decision Log 3, the user's landing
2126
+ * "the re-form"), and the value is G0's rather than the holdout row's: §5.69
2127
+ * §1's bounded per-span reading is 8 device px at span 96 and 11 at 160, a
2128
+ * ratio of 1.375, and this curve reads 0.352 at span 160, so 4.8 + (9.9 −
2129
+ * 4.8) · 0.352 reproduces that ratio over the base gain of 6 device px. The
2130
+ * heavy width at dpr 2 is therefore 6.0 device px at spans ≤ 96, 6.7 at 128,
2131
+ * 8.2 at 160 and 12.4 at 256 and beyond. The calibration cells neither chose
2132
+ * the value nor rejected it — `stage3` swept 4.8 / 7.5 / 9.9 / 12.5 and only
2133
+ * `rrect-ml` (span 128, a tenth of the grading) moves, its interior spread
2134
+ * 0.1125 → 0.0993 against native 0.1018 at 9.9, which is the sweep's best on
2135
+ * its own objective. The confirmation's holdout `rrect-lg` rose 0.9661 →
2136
+ * 0.9762 with its interior spread 0.0721 against native 0.0810.
2137
+ */
2138
+ readonly sizeScatterGainFar2x: number;
2139
+ /**
2140
+ * **The body's depth ramp** (W13 G1, from the measurement of claims §5.61 §2
2141
+ * and the re-forming its runtime sweep forced) — a near-contour excursion on
2142
+ * the sharp component's share, riding on top of the span law
2143
+ * `sizeScatterSpanMax` supplies rather than replacing it.
2144
+ *
2145
+ * ```
2146
+ * kDeep(span) = sizeScatterFloor + (1 − sizeScatterFloor)
2147
+ * · smoothstep(sizeSpanMin, sizeScatterSpanMax, span)
2148
+ * sDeep(span) = 1 − kDeep(span)
2149
+ * s₀(span) = startThin + (startThick − startThin) · sizeThickness(span)
2150
+ * s(u, span) = sDeep + max(0, s₀(span) − sDeep) · max(0, 1 − u / U(dpr))
2151
+ * k(u, span) = 1 − s(u, span)
2152
+ * ```
2153
+ *
2154
+ * with `u` the pixel's depth under the contour and `U` the reach, both in
2155
+ * DEVICE px. `s₀` is the sharp share **at the contour** and `U` is where the
2156
+ * excursion vanishes into the deep value — not where a line from the start
2157
+ * would hit zero, which is what the first form's reach meant. Deep inside any
2158
+ * surface the body is exactly the W11c/W12 material; within `U` of the
2159
+ * contour the sharp component is lifted toward `s₀`, which is the band the
2160
+ * reference has and the uniform share does not.
2161
+ *
2162
+ * **Why the start grades with the span, in the third form.** The second form
2163
+ * gave the excursion one start per scale and its runtime sweep refuted that
2164
+ * too, arithmetically rather than for want of a better point (claims §5.64
2165
+ * §2): `rrect-sm`'s span is exactly `sizeSpanMin`, so its deep sharp share is
2166
+ * exactly `1 − sizeScatterFloor` = 0.600 and no start at or below 0.600 can
2167
+ * touch it, while `rrect-ml`'s band only improves below a start near 0.583.
2168
+ * The window where both hold is empty, and the reach cannot open it — the
2169
+ * reach decides how much of a surface the excursion covers, never which
2170
+ * surfaces it touches, because `max(0, s₀ − sDeep(span))` has no reach in it.
2171
+ * G0 read the reference's start as strongly graded by span (0.637 / 0.642 on
2172
+ * the thin cells against 0.512 / 0.501 / 0.410 on the thick ones at 1x), so
2173
+ * the start is given exactly that grading — across `sizeThickness`, the
2174
+ * material's OWN thin/thick curve with its knee at 64, the one the face's
2175
+ * tone response and the outer shadow already blend across. Reusing it is the
2176
+ * point: it introduces no new span statistic, and `sizeSpanMax` stays where
2177
+ * every other facet reads it.
2178
+ *
2179
+ * **Why this form and not the ramp alone.** W13 G0 measured a ramp with a
2180
+ * free start, reach and floor (H2) and the first implementation took the free
2181
+ * start and reach with a floor of zero, retiring the span law. Its runtime
2182
+ * sweep — 81 points, both scales, the real renderer — could not reach the
2183
+ * wave's stops at any point, and named the mechanism: the ramp's projection
2184
+ * onto one number per surface runs 0.43–0.56 at 1x where the retired span law
2185
+ * ran 0.41–1.00, so the family is nearly span-flat and the bed is strongly
2186
+ * span-graded; small spans want a high start and large spans a low one and no
2187
+ * pair can be both (`.../g1/sweep/g1-sweep.md` §4). §7 of the same report
2188
+ * asked for exactly this: "the ramp's DEEP value wants to be the span-graded
2189
+ * heavy share the retired law supplied, and its near-contour excursion the
2190
+ * sharp term the band asks for." The floor H2 left free is therefore not one
2191
+ * more constant but the span law itself, which is already fitted.
2192
+ *
2193
+ * The reach stays a LENGTH in device pixels, which is the reading that did
2194
+ * survive the sweep: the free fits' reaches in absolute depth spread by 1.3×
2195
+ * across the spans (108 / 115 / 144 CSS px at 1x on `rrect-lg` / `-ml` /
2196
+ * `-md`) where the reaches as a fraction of the half-span spread by 2.2×, and
2197
+ * between the two scales that length roughly halves in CSS px — one length in
2198
+ * device pixels, the same reading as the widths (§5.55 §1, §5.56 §1).
2199
+ *
2200
+ * The start and the reach are anchored at the two scales the reference was
2201
+ * measured at rather than given a scale term: `…1x` is the value at dpr 1,
2202
+ * `…2x` at dpr 2, the pair interpolated linearly in dpr and held constant
2203
+ * outside [1, 2] (`scatterRampStart`, `scatterRampReachDevicePx`).
2204
+ *
2205
+ * **The FOURTH form: the start keeps falling past the thickness knee (W13
2206
+ * Decision Log 6; claims §5.67 §4, §6).** The third form's holdout failed on
2207
+ * one row for the form's own arithmetic: `sizeThickness` saturates at
2208
+ * `sizeSpanMax` 96, so spans 96, 128, 130 and 160 all received the identical
2209
+ * thick start while G0 read the reference's start FALLING across exactly
2210
+ * those spans (0.512 → 0.501 → 0.410), and because the deep value keeps
2211
+ * falling to `sizeScatterSpanMax` the excursion GREW with span (0.039 →
2212
+ * 0.156 → 0.284) where the reference's shrinks — `rrect-lg` overshot its
2213
+ * interior by 33%. So the start gets a slow decline along the scatter
2214
+ * facet's own curve above the knee, `startFar` being its value at span ≥
2215
+ * `sizeScatterSpanMax`:
2216
+ *
2217
+ * s₀(span) = thin + (thick − thin) · sizeThickness(span)
2218
+ * + (far − thick) · smoothstep(sizeSpanMax, sizeScatterSpanMax, span)
2219
+ *
2220
+ * Two curves the material already has, one more constant per scale, and no
2221
+ * new span statistic. At 2x the decline is switched off rather than inverted:
2222
+ * `far` and `thick` carry the same number since W15 G1, because G0 read the
2223
+ * reference's 2x start FLAT across the thick spans (claims §5.69 §2, §5.70 §6
2224
+ * (iv)) — the decline is a 1x feature of this form.
2225
+ *
2226
+ * The 1x three are FITTED (W13 G1's third and fourth sweeps) and the 2x four
2227
+ * are FITTED or read from G0 by W15 G1 (claims §5.70 §2 and §8); no constant
2228
+ * here lands on a paper prediction, because the paper model over-credited the
2229
+ * mip chain's heavy tap once already (§5.58 §1). What they carry:
2230
+ *
2231
+ * **1x — thin 0.64, thick 0.52, reach 120 device px.** G0's own start
2232
+ * readings are 0.637 on `rrect-sm` and 0.642 on the capsule at the thin end
2233
+ * and 0.512 / 0.501 / 0.410 on `rrect-md` / `-ml` / `-lg` at the thick end.
2234
+ * A thick anchor fitted to all three thick cells jointly comes out near 0.47,
2235
+ * and 0.47 sits 0.011 *below* `rrect-md`'s own deep sharp share of 0.481,
2236
+ * which would clamp the excursion to zero on that one cell. 0.52 is above it
2237
+ * and is also G0's reading on that cell, so the fit is not traded against the
2238
+ * form's own arithmetic.
2239
+ *
2240
+ * **2x — thin 0.46, thick 0.21, far 0.21, reach 100 device px, and the ramp
2241
+ * is now the WHOLE body above the deep value** (W15 G1, claims §5.70 §1–§2).
2242
+ * W13 left these inert for the deep value's sake: at `sizeScatterFloor2x` 0.4
2243
+ * every anchor sat below its cell's deep sharp share and `max(0, s₀ − sDeep)`
2244
+ * was bit-exactly zero on the whole bed. W15 G1 fitted that deep value fully
2245
+ * heavy (`sizeScatterFloor2x` 1.0), so the deep sharp share at dpr 2 is 0 and
2246
+ * the anchors act on the numbers they were carrying — which is why the wave's
2247
+ * three gaps turned out to be one gap (§5.70 §6 (i)).
2248
+ *
2249
+ * The values are G0's readings where the sweep was flat and the sweep's where
2250
+ * it was not. **Thin 0.46** is G0's u 6 reading exactly (0.494 / 0.468 on the
2251
+ * thin cells) and stage 2b's best, over a top nine points within 0.002 of
2252
+ * each other. **Thick and far 0.21**: G0's 2x starts on the thick cells are
2253
+ * 0.163 / 0.199 / 0.210 at their own widths and 0.192 / 0.199 / 0.195 at one
2254
+ * common width — flat with span, not declining — so the two anchors take one
2255
+ * number and the fourth form's decline is off at this scale; stage 2a
2256
+ * measured the objective flat over 0.17–0.25 and worse at 0.33. **Reach 100
2257
+ * device px** = 50 CSS px against G0's measured 49 / 53 / 56, and stage 2b
2258
+ * found 100 and 130 indifferent.
2259
+ *
2260
+ * **far — 0.20 at 1x (FITTED on the W14 bed), 0.21 at 2x.** The fourth
2261
+ * sweep (`results/2026-09-03-w13-ramp/g1/sweep-4/`) swept far over eight
2262
+ * points from 0.52 (the third form) down to 0.15: S1 and S4 pass at every
2263
+ * one, only `rrect-ml`'s rows move and they improve monotonically as far
2264
+ * falls, and the band is flat within the bed's noise below 0.30. The cell
2265
+ * the constant exists for is holdout, so the tie inside the noise is broken
2266
+ * by the reference's own reading — G0's `rrect-lg` start of 0.410 at span 160
2267
+ * is far = 0.207 through this form — and 0.20 is the measured grid point that
2268
+ * carries it. The confirmation read `rrect-lg` at `ssimMean` +0.0056 against
2269
+ * the W14 bed (the third form: −0.0026) with its interior 12% over the
2270
+ * reference (from 33% over). At 2x far equals the thick anchor, so the start
2271
+ * is flat past the knee at that scale — G0's own reading (§5.69 §2), and the
2272
+ * holdout's band supports it (`rrect-lg` +0.0106, claims §5.70 §8).
2273
+ *
2274
+ * At dpr 1 none of the 2x four is read at all: `rampAtScale` holds every one
2275
+ * of them at its 1x anchor below dpr 1, so the 1x material is byte-identical
2276
+ * to the W13 bed and the landing's confirmation measured that on 49 of 49 1x
2277
+ * GPU cells (claims §5.70 §8).
2278
+ */
2279
+ readonly sizeScatterRampStartThin1x: number;
2280
+ readonly sizeScatterRampStartThick1x: number;
2281
+ readonly sizeScatterRampStartFar1x: number;
2282
+ readonly sizeScatterRampStartThin2x: number;
2283
+ readonly sizeScatterRampStartThick2x: number;
2284
+ readonly sizeScatterRampStartFar2x: number;
2285
+ readonly sizeScatterRampReach1xPx: number;
2286
+ readonly sizeScatterRampReach2xPx: number;
1833
2287
  /**
1834
2288
  * The occlusion gain — "a larger size is more opaque. A smaller size is
1835
2289
  * clearer" (S284). The fraction of the *remaining* transparency the size law
@@ -1861,16 +2315,63 @@ interface MaterialProfile {
1861
2315
  */
1862
2316
  readonly sizeShadowGainMax: number;
1863
2317
  /**
1864
- * The lens's magnitude: the contour displacement in lens depths (W11c G2).
2318
+ * The lens (W12 G2, claims §5.51) — one steep power on the reference's own
2319
+ * span law, along a direction the reference ovalizes.
2320
+ *
2321
+ * The reference's `glassBackground` filter takes an inner refraction *amount*
2322
+ * and *height* that are clamped linear functions of the shape's shorter side
2323
+ * (claims §5.50: amount −min(0.8·span, 60), height min(0.25·span, 20)). What
2324
+ * those two numbers do spatially is not in the tree; measured as a field on
2325
+ * the captures (§5.49) and ranked on the pixels (§5.51), the band is
2326
+ *
2327
+ * D(u) = S · max(0, 1 − u / L′)^p, S = lensRefractionGain · A(span),
2328
+ * L′ = lensExtentGain · lensDepth,
1865
2329
  *
1866
- * The shader reads the body from `lensDepth × lensRefractionGain × (1 − depth)²`
1867
- * further inside, so the band is the plate folded back from that far in. The
1868
- * two rim-LOD constants that used to sit here (`lensBodyLodPerPx`,
1869
- * `lensRimLodBias`) are retired: the reference's band is not sharper than its
1870
- * interior — W11c G2 measured σ 6 → 4 → 3 → the deep value across the band —
1871
- * and the "sharper rim" was the fold, not a finer sample.
2330
+ * with `lensDepth = (thickness / lensThicknessReference) × H(span)` the
2331
+ * reference's height law scaled by the author's thickness (8 is the default
2332
+ * and the reference's unit — at 8 the depth IS Apple's height, 8 / 11 / 20 on
2333
+ * spans 32 / 44 / ≥ 80), `A(span)` the amount law scaled the same way, and
2334
+ * `p = lensProfileExponent`. Apple's own two-term profile at its literal
2335
+ * amounts was ranked too and lost on the pixels and the holdout; its span law
2336
+ * is adopted, its shape is not (§5.51 §2).
2337
+ *
2338
+ * `lensRefractionGain` is therefore re-based: it was 1.6 lens depths on the
2339
+ * W11c square profile (S = 1.6 × 20.8 = 33.3 at saturation), it is now the
2340
+ * scale on the reference's amount (S = 0.745 × 60 = 44.7), fitted on
2341
+ * `rrect-md` + `-ml` at 1x with `rrect-lg` held out.
1872
2342
  */
1873
2343
  readonly lensRefractionGain: number;
2344
+ /** The reference's inner refraction height law: `min(lensHeightPerSpan · span, lensHeightMax)`. */
2345
+ readonly lensHeightPerSpan: number;
2346
+ readonly lensHeightMax: number;
2347
+ /** The reference's inner refraction amount law: `min(lensAmountPerSpan · span, lensAmountMax)`. */
2348
+ readonly lensAmountPerSpan: number;
2349
+ readonly lensAmountMax: number;
2350
+ /**
2351
+ * The author `thickness` at which the lens depth equals the reference's own
2352
+ * height — the host's default, and what the bed was captured at. A thicker
2353
+ * authoring scales the depth and the magnitude together.
2354
+ */
2355
+ readonly lensThicknessReference: number;
2356
+ /** The profile's extent over the lens depth: D reaches zero at `lensExtentGain × lensDepth`. */
2357
+ readonly lensExtentGain: number;
2358
+ /** The profile's exponent — the square of W11c became a steeper power (§5.49 §2). */
2359
+ readonly lensProfileExponent: number;
2360
+ /**
2361
+ * The direction's ovalization (§5.49 §3, §5.50): the reference's SDF element
2362
+ * carries `gradientOvalization`, and the band is magnified *along* the edge by
2363
+ * up to 1.31× as a result. The shader displaces along the gradient of the
2364
+ * blended field `(1 − ω)·d_rrect + ω·d_oval`, `d_oval` the signed distance of
2365
+ * the ellipse inscribed in the surface's box, with the magnitude fixed. The
2366
+ * reference's value is 0.5 on thick shapes and 0 on thin ones; 0.6 is what the
2367
+ * pixels want on the box-inscribed ellipse (Apple's oval is more curved at the
2368
+ * edge midpoint than that ellipse). The switch is a step in the reference
2369
+ * between spans 64 and 72; here it is a smoothstep over that band, the same at
2370
+ * both ends and continuous through a morph.
2371
+ */
2372
+ readonly lensOvalization: number;
2373
+ readonly lensOvalizationSpanMin: number;
2374
+ readonly lensOvalizationSpanMax: number;
1874
2375
  /**
1875
2376
  * What each accessibility regime does to the numbers above. The multipliers
1876
2377
  * match `platform-web`'s CSS tier so the two renderers degrade the same way
@@ -2055,9 +2556,31 @@ interface MaterialProfilePatch {
2055
2556
  readonly sizeScatterGainMax?: number;
2056
2557
  readonly sizeScatterFloor?: number;
2057
2558
  readonly sizeScatterSpanMax?: number;
2559
+ readonly sizeScatterGainMax2x?: number;
2560
+ readonly sizeScatterFloor2x?: number;
2561
+ readonly sizeScatterSpanMax2x?: number;
2562
+ readonly sizeScatterGainFar2x?: number;
2563
+ readonly sizeScatterRampStartThin1x?: number;
2564
+ readonly sizeScatterRampStartThick1x?: number;
2565
+ readonly sizeScatterRampStartFar1x?: number;
2566
+ readonly sizeScatterRampStartThin2x?: number;
2567
+ readonly sizeScatterRampStartThick2x?: number;
2568
+ readonly sizeScatterRampStartFar2x?: number;
2569
+ readonly sizeScatterRampReach1xPx?: number;
2570
+ readonly sizeScatterRampReach2xPx?: number;
2058
2571
  readonly sizeOcclusionGain?: number;
2059
2572
  readonly sizeShadowGainMax?: number;
2060
2573
  readonly lensRefractionGain?: number;
2574
+ readonly lensHeightPerSpan?: number;
2575
+ readonly lensHeightMax?: number;
2576
+ readonly lensAmountPerSpan?: number;
2577
+ readonly lensAmountMax?: number;
2578
+ readonly lensThicknessReference?: number;
2579
+ readonly lensExtentGain?: number;
2580
+ readonly lensProfileExponent?: number;
2581
+ readonly lensOvalization?: number;
2582
+ readonly lensOvalizationSpanMin?: number;
2583
+ readonly lensOvalizationSpanMax?: number;
2061
2584
  readonly reducedTransparencyFrost?: number;
2062
2585
  readonly increasedOcclusionLift?: number;
2063
2586
  readonly strongBorderRim?: Readonly<Partial<MaterialRim>>;
@@ -2854,6 +3377,16 @@ interface PyramidResources {
2854
3377
  readonly texelsPerCss: number;
2855
3378
  readonly sourceWidth: number;
2856
3379
  readonly sourceHeight: number;
3380
+ /**
3381
+ * The CSS-px σ the build converted with (W13 G1, review finding). The density
3382
+ * alone does not determine the body: since the widths became device-pixel
3383
+ * quantities (W12 G3, claims §5.56) the material's σ in CSS px is
3384
+ * `blurSigma / dpr`, so a window dragged from a 1x display to a 2x one asks
3385
+ * for a different body from the same source at the same density. A static
3386
+ * image never re-dirties, so this recorded σ is the only signal that the
3387
+ * chain's body and `bodyChainLod` belong to the previous scale.
3388
+ */
3389
+ readonly bodySigmaCss: number;
2857
3390
  }
2858
3391
  interface PyramidInstrumentation {
2859
3392
  /** Successful rebuilds since the store was created. */