@vitreajs/vitrea 0.3.0 → 0.4.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.
1671
1710
  */
1672
- readonly occlusion: number;
1711
+ readonly thinOcclusionMid: number;
1673
1712
  /**
1674
- * What reduced transparency does to `occlusion` — MEASURED, not assumed, which
1675
- * is what the charter asked for before the fold was written.
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.
1723
+ */
1724
+ readonly thinOcclusionBright: number;
1725
+ /**
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,211 @@ 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 depth ramp** (W13 G1, from the measurement of claims §5.61 §2
2036
+ * and the re-forming its runtime sweep forced) — a near-contour excursion on
2037
+ * the sharp component's share, riding on top of the span law
2038
+ * `sizeScatterSpanMax` supplies rather than replacing it.
2039
+ *
2040
+ * ```
2041
+ * kDeep(span) = sizeScatterFloor + (1 − sizeScatterFloor)
2042
+ * · smoothstep(sizeSpanMin, sizeScatterSpanMax, span)
2043
+ * sDeep(span) = 1 − kDeep(span)
2044
+ * s₀(span) = startThin + (startThick − startThin) · sizeThickness(span)
2045
+ * s(u, span) = sDeep + max(0, s₀(span) − sDeep) · max(0, 1 − u / U(dpr))
2046
+ * k(u, span) = 1 − s(u, span)
2047
+ * ```
2048
+ *
2049
+ * with `u` the pixel's depth under the contour and `U` the reach, both in
2050
+ * DEVICE px. `s₀` is the sharp share **at the contour** and `U` is where the
2051
+ * excursion vanishes into the deep value — not where a line from the start
2052
+ * would hit zero, which is what the first form's reach meant. Deep inside any
2053
+ * surface the body is exactly the W11c/W12 material; within `U` of the
2054
+ * contour the sharp component is lifted toward `s₀`, which is the band the
2055
+ * reference has and the uniform share does not.
2056
+ *
2057
+ * **Why the start grades with the span, in the third form.** The second form
2058
+ * gave the excursion one start per scale and its runtime sweep refuted that
2059
+ * too, arithmetically rather than for want of a better point (claims §5.64
2060
+ * §2): `rrect-sm`'s span is exactly `sizeSpanMin`, so its deep sharp share is
2061
+ * exactly `1 − sizeScatterFloor` = 0.600 and no start at or below 0.600 can
2062
+ * touch it, while `rrect-ml`'s band only improves below a start near 0.583.
2063
+ * The window where both hold is empty, and the reach cannot open it — the
2064
+ * reach decides how much of a surface the excursion covers, never which
2065
+ * surfaces it touches, because `max(0, s₀ − sDeep(span))` has no reach in it.
2066
+ * G0 read the reference's start as strongly graded by span (0.637 / 0.642 on
2067
+ * the thin cells against 0.512 / 0.501 / 0.410 on the thick ones at 1x), so
2068
+ * the start is given exactly that grading — across `sizeThickness`, the
2069
+ * material's OWN thin/thick curve with its knee at 64, the one the face's
2070
+ * tone response and the outer shadow already blend across. Reusing it is the
2071
+ * point: it introduces no new span statistic, and `sizeSpanMax` stays where
2072
+ * every other facet reads it.
2073
+ *
2074
+ * **Why this form and not the ramp alone.** W13 G0 measured a ramp with a
2075
+ * free start, reach and floor (H2) and the first implementation took the free
2076
+ * start and reach with a floor of zero, retiring the span law. Its runtime
2077
+ * sweep — 81 points, both scales, the real renderer — could not reach the
2078
+ * wave's stops at any point, and named the mechanism: the ramp's projection
2079
+ * onto one number per surface runs 0.43–0.56 at 1x where the retired span law
2080
+ * ran 0.41–1.00, so the family is nearly span-flat and the bed is strongly
2081
+ * span-graded; small spans want a high start and large spans a low one and no
2082
+ * pair can be both (`.../g1/sweep/g1-sweep.md` §4). §7 of the same report
2083
+ * asked for exactly this: "the ramp's DEEP value wants to be the span-graded
2084
+ * heavy share the retired law supplied, and its near-contour excursion the
2085
+ * sharp term the band asks for." The floor H2 left free is therefore not one
2086
+ * more constant but the span law itself, which is already fitted.
2087
+ *
2088
+ * The reach stays a LENGTH in device pixels, which is the reading that did
2089
+ * survive the sweep: the free fits' reaches in absolute depth spread by 1.3×
2090
+ * across the spans (108 / 115 / 144 CSS px at 1x on `rrect-lg` / `-ml` /
2091
+ * `-md`) where the reaches as a fraction of the half-span spread by 2.2×, and
2092
+ * between the two scales that length roughly halves in CSS px — one length in
2093
+ * device pixels, the same reading as the widths (§5.55 §1, §5.56 §1).
2094
+ *
2095
+ * The start and the reach are anchored at the two scales the reference was
2096
+ * measured at rather than given a scale term: `…1x` is the value at dpr 1,
2097
+ * `…2x` at dpr 2, the pair interpolated linearly in dpr and held constant
2098
+ * outside [1, 2] (`scatterRampStart`, `scatterRampReachDevicePx`).
2099
+ *
2100
+ * **The FOURTH form: the start keeps falling past the thickness knee (W13
2101
+ * Decision Log 6; claims §5.67 §4, §6).** The third form's holdout failed on
2102
+ * one row for the form's own arithmetic: `sizeThickness` saturates at
2103
+ * `sizeSpanMax` 96, so spans 96, 128, 130 and 160 all received the identical
2104
+ * thick start while G0 read the reference's start FALLING across exactly
2105
+ * those spans (0.512 → 0.501 → 0.410), and because the deep value keeps
2106
+ * falling to `sizeScatterSpanMax` the excursion GREW with span (0.039 →
2107
+ * 0.156 → 0.284) where the reference's shrinks — `rrect-lg` overshot its
2108
+ * interior by 33%. So the start gets a slow decline along the scatter
2109
+ * facet's own curve above the knee, `startFar` being its value at span ≥
2110
+ * `sizeScatterSpanMax`:
2111
+ *
2112
+ * s₀(span) = thin + (thick − thin) · sizeThickness(span)
2113
+ * + (far − thick) · smoothstep(sizeSpanMax, sizeScatterSpanMax, span)
2114
+ *
2115
+ * Two curves the material already has, one more constant per scale, and no
2116
+ * new span statistic. At 2x `far` sits below the thick anchor, so the null
2117
+ * the third form verified bit-exactly (§5.67 §2) holds by construction: an
2118
+ * excursion that was zero at every span stays zero when its start falls
2119
+ * further.
2120
+ *
2121
+ * PROVISIONAL, all eight. The runtime sweep at this form sets them, because
2122
+ * the paper model over-credited the mip chain's heavy tap once already
2123
+ * (§5.58 §1) and no constant lands on a paper prediction again. What they
2124
+ * carry now:
2125
+ *
2126
+ * **1x — thin 0.64, thick 0.52, reach 120 device px.** G0's own start
2127
+ * readings are 0.637 on `rrect-sm` and 0.642 on the capsule at the thin end
2128
+ * and 0.512 / 0.501 / 0.410 on `rrect-md` / `-ml` / `-lg` at the thick end.
2129
+ * A thick anchor fitted to all three thick cells jointly comes out near 0.47,
2130
+ * and 0.47 sits 0.011 *below* `rrect-md`'s own deep sharp share of 0.481,
2131
+ * which would clamp the excursion to zero on that one cell. 0.52 is above it
2132
+ * and is also G0's reading on that cell, so the fit is not traded against the
2133
+ * form's own arithmetic.
2134
+ *
2135
+ * **2x — thin 0.46, thick 0.17, reach 100 device px, and the excursion clamps
2136
+ * to zero on every cell of the calibration bed.** These are G0's 2x readings
2137
+ * (0.483 / 0.437 on the thin cells, 0.192 / 0.179 / 0.141 on the thick ones),
2138
+ * and every one of them sits BELOW its cell's deep sharp share: the implied
2139
+ * excursions run −0.095 to −0.289 (claims §5.64 §4). `max(0, s₀ − sDeep)` is
2140
+ * therefore zero everywhere on this bed at dpr 2. That is not a special case
2141
+ * and not a disabled facet — it is the law evaluating to no excursion where
2142
+ * the reference's own contour share is heavier than vitrea's deep value. It
2143
+ * follows that **the 2x gap is a deep-value gap and not a ramp gap**: the
2144
+ * span law's floor, knee and top are what miss at that scale, and no
2145
+ * one-signed excursion above them can express it. That fit is W13's Deferred
2146
+ * charter and not this constant's business.
2147
+ *
2148
+ * **far — 0.20 at 1x (FITTED on the W14 bed), 0.15 at 2x.** The fourth
2149
+ * sweep (`results/2026-09-03-w13-ramp/g1/sweep-4/`) swept far over eight
2150
+ * points from 0.52 (the third form) down to 0.15: S1 and S4 pass at every
2151
+ * one, only `rrect-ml`'s rows move and they improve monotonically as far
2152
+ * falls, and the band is flat within the bed's noise below 0.30. The cell
2153
+ * the constant exists for is holdout, so the tie inside the noise is broken
2154
+ * by the reference's own reading — G0's `rrect-lg` start of 0.410 at span 160
2155
+ * is far = 0.207 through this form — and 0.20 is the measured grid point that
2156
+ * carries it. The confirmation read `rrect-lg` at `ssimMean` +0.0056 against
2157
+ * the W14 bed (the third form: −0.0026) with its interior 12% over the
2158
+ * reference (from 33% over). At 2x far is below the thick anchor so that the
2159
+ * null holds — re-verified bit-exact under this form.
2160
+ */
2161
+ readonly sizeScatterRampStartThin1x: number;
2162
+ readonly sizeScatterRampStartThick1x: number;
2163
+ readonly sizeScatterRampStartFar1x: number;
2164
+ readonly sizeScatterRampStartThin2x: number;
2165
+ readonly sizeScatterRampStartThick2x: number;
2166
+ readonly sizeScatterRampStartFar2x: number;
2167
+ readonly sizeScatterRampReach1xPx: number;
2168
+ readonly sizeScatterRampReach2xPx: number;
1833
2169
  /**
1834
2170
  * The occlusion gain — "a larger size is more opaque. A smaller size is
1835
2171
  * clearer" (S284). The fraction of the *remaining* transparency the size law
@@ -1861,16 +2197,63 @@ interface MaterialProfile {
1861
2197
  */
1862
2198
  readonly sizeShadowGainMax: number;
1863
2199
  /**
1864
- * The lens's magnitude: the contour displacement in lens depths (W11c G2).
2200
+ * The lens (W12 G2, claims §5.51) — one steep power on the reference's own
2201
+ * span law, along a direction the reference ovalizes.
1865
2202
  *
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.
2203
+ * The reference's `glassBackground` filter takes an inner refraction *amount*
2204
+ * and *height* that are clamped linear functions of the shape's shorter side
2205
+ * (claims §5.50: amount −min(0.8·span, 60), height min(0.25·span, 20)). What
2206
+ * those two numbers do spatially is not in the tree; measured as a field on
2207
+ * the captures (§5.49) and ranked on the pixels (§5.51), the band is
2208
+ *
2209
+ * D(u) = S · max(0, 1 − u / L′)^p, S = lensRefractionGain · A(span),
2210
+ * L′ = lensExtentGain · lensDepth,
2211
+ *
2212
+ * with `lensDepth = (thickness / lensThicknessReference) × H(span)` the
2213
+ * reference's height law scaled by the author's thickness (8 is the default
2214
+ * and the reference's unit — at 8 the depth IS Apple's height, 8 / 11 / 20 on
2215
+ * spans 32 / 44 / ≥ 80), `A(span)` the amount law scaled the same way, and
2216
+ * `p = lensProfileExponent`. Apple's own two-term profile at its literal
2217
+ * amounts was ranked too and lost on the pixels and the holdout; its span law
2218
+ * is adopted, its shape is not (§5.51 §2).
2219
+ *
2220
+ * `lensRefractionGain` is therefore re-based: it was 1.6 lens depths on the
2221
+ * W11c square profile (S = 1.6 × 20.8 = 33.3 at saturation), it is now the
2222
+ * scale on the reference's amount (S = 0.745 × 60 = 44.7), fitted on
2223
+ * `rrect-md` + `-ml` at 1x with `rrect-lg` held out.
1872
2224
  */
1873
2225
  readonly lensRefractionGain: number;
2226
+ /** The reference's inner refraction height law: `min(lensHeightPerSpan · span, lensHeightMax)`. */
2227
+ readonly lensHeightPerSpan: number;
2228
+ readonly lensHeightMax: number;
2229
+ /** The reference's inner refraction amount law: `min(lensAmountPerSpan · span, lensAmountMax)`. */
2230
+ readonly lensAmountPerSpan: number;
2231
+ readonly lensAmountMax: number;
2232
+ /**
2233
+ * The author `thickness` at which the lens depth equals the reference's own
2234
+ * height — the host's default, and what the bed was captured at. A thicker
2235
+ * authoring scales the depth and the magnitude together.
2236
+ */
2237
+ readonly lensThicknessReference: number;
2238
+ /** The profile's extent over the lens depth: D reaches zero at `lensExtentGain × lensDepth`. */
2239
+ readonly lensExtentGain: number;
2240
+ /** The profile's exponent — the square of W11c became a steeper power (§5.49 §2). */
2241
+ readonly lensProfileExponent: number;
2242
+ /**
2243
+ * The direction's ovalization (§5.49 §3, §5.50): the reference's SDF element
2244
+ * carries `gradientOvalization`, and the band is magnified *along* the edge by
2245
+ * up to 1.31× as a result. The shader displaces along the gradient of the
2246
+ * blended field `(1 − ω)·d_rrect + ω·d_oval`, `d_oval` the signed distance of
2247
+ * the ellipse inscribed in the surface's box, with the magnitude fixed. The
2248
+ * reference's value is 0.5 on thick shapes and 0 on thin ones; 0.6 is what the
2249
+ * pixels want on the box-inscribed ellipse (Apple's oval is more curved at the
2250
+ * edge midpoint than that ellipse). The switch is a step in the reference
2251
+ * between spans 64 and 72; here it is a smoothstep over that band, the same at
2252
+ * both ends and continuous through a morph.
2253
+ */
2254
+ readonly lensOvalization: number;
2255
+ readonly lensOvalizationSpanMin: number;
2256
+ readonly lensOvalizationSpanMax: number;
1874
2257
  /**
1875
2258
  * What each accessibility regime does to the numbers above. The multipliers
1876
2259
  * match `platform-web`'s CSS tier so the two renderers degrade the same way
@@ -2055,9 +2438,27 @@ interface MaterialProfilePatch {
2055
2438
  readonly sizeScatterGainMax?: number;
2056
2439
  readonly sizeScatterFloor?: number;
2057
2440
  readonly sizeScatterSpanMax?: number;
2441
+ readonly sizeScatterRampStartThin1x?: number;
2442
+ readonly sizeScatterRampStartThick1x?: number;
2443
+ readonly sizeScatterRampStartFar1x?: number;
2444
+ readonly sizeScatterRampStartThin2x?: number;
2445
+ readonly sizeScatterRampStartThick2x?: number;
2446
+ readonly sizeScatterRampStartFar2x?: number;
2447
+ readonly sizeScatterRampReach1xPx?: number;
2448
+ readonly sizeScatterRampReach2xPx?: number;
2058
2449
  readonly sizeOcclusionGain?: number;
2059
2450
  readonly sizeShadowGainMax?: number;
2060
2451
  readonly lensRefractionGain?: number;
2452
+ readonly lensHeightPerSpan?: number;
2453
+ readonly lensHeightMax?: number;
2454
+ readonly lensAmountPerSpan?: number;
2455
+ readonly lensAmountMax?: number;
2456
+ readonly lensThicknessReference?: number;
2457
+ readonly lensExtentGain?: number;
2458
+ readonly lensProfileExponent?: number;
2459
+ readonly lensOvalization?: number;
2460
+ readonly lensOvalizationSpanMin?: number;
2461
+ readonly lensOvalizationSpanMax?: number;
2061
2462
  readonly reducedTransparencyFrost?: number;
2062
2463
  readonly increasedOcclusionLift?: number;
2063
2464
  readonly strongBorderRim?: Readonly<Partial<MaterialRim>>;
@@ -2854,6 +3255,16 @@ interface PyramidResources {
2854
3255
  readonly texelsPerCss: number;
2855
3256
  readonly sourceWidth: number;
2856
3257
  readonly sourceHeight: number;
3258
+ /**
3259
+ * The CSS-px σ the build converted with (W13 G1, review finding). The density
3260
+ * alone does not determine the body: since the widths became device-pixel
3261
+ * quantities (W12 G3, claims §5.56) the material's σ in CSS px is
3262
+ * `blurSigma / dpr`, so a window dragged from a 1x display to a 2x one asks
3263
+ * for a different body from the same source at the same density. A static
3264
+ * image never re-dirties, so this recorded σ is the only signal that the
3265
+ * chain's body and `bodyChainLod` belong to the previous scale.
3266
+ */
3267
+ readonly bodySigmaCss: number;
2857
3268
  }
2858
3269
  interface PyramidInstrumentation {
2859
3270
  /** Successful rebuilds since the store was created. */
package/dist/index.js CHANGED
@@ -1092,7 +1092,7 @@ function isHealthy(state) {
1092
1092
 
1093
1093
  // src/renderer-seam.ts
1094
1094
  async function loadWebGPURendererModule() {
1095
- return import('./dist-MVSXUP3K.js');
1095
+ return import('./dist-RGWZAZ6J.js');
1096
1096
  }
1097
1097
  async function loadWebGPURenderer() {
1098
1098
  const { createWebGPURenderer } = await loadWebGPURendererModule();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitreajs/vitrea",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Framework-agnostic Liquid Glass material runtime: scene model, capability resolution, material policy, accessibility policy.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/SSFSKIM/designer",