scene: terrain mesh as fine as the height map (stack: terrain scatter, albedo, stars, haze) #42
Loading…
Reference in a new issue
No description provided.
Delete branch "nibu/scene-terrain-scatter-dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Update: head
ef961636Delta over
a773bc49: one commit,src/app/pages/auth/styles.css.tsonly. The scene sky is one fixed dusk for every theme, so the translucent card failed the Register link on Midnight and Light/Silver (Libby). The card is now opaque for every theme, with no backdrop-filter, so text and link contrast depend on neither the scene nor a blur. Themes without--sky-bubble(Light, Silver, Dark, Butter) get link#99c7ffon the card; Midnight and Noonday keep their own. The comment above the rule now covers the link and carries this table.Ratios are WCAG 2.x, computed from the tokens, and hold for any backdrop because the card is opaque. For reference, Light's own link (hsl 213 100% 45%) on #0d1a26 is 2.49, matching Libby. Silver's own link I did not compute. The earlier 4.5:1 figure for 54% was Nibu's estimate, not Void's, and is now moot.
Tests: full suite 472 pass (scene directory 262).
tschere fails on matrix-js-sdk imports in files this change does not touch.Still unverified: no render of the card in any theme (ratios are from tokens; the
body:not(.gamecult-theme)link override has not been seen in a browser); reduced-motion, webgl2-off and real-GPU probes;onContextLost(host.ts:28, Terrain.ts:364) is an open follow-up. Not merged.Update: head
a773bc49Delta over
78a7dbe9(one commit,src/app/pages/auth/styles.css.tsonly): Libby found the 54% card failing AA in Noonday Sky over shaded terrain (text 2.99:1, Register link 2.06:1). Noonday's card is now opaque (the bubble colour, no transparency); Midnight stays at 54%. The 4.5:1 figure for 54% was Nibu's estimate, not Void's.WCAG ratios, computed. Noonday (bubble #b9b6af, text #342d25, link #2a4f27), card over black / over white: 54% fill text 2.23 / 9.51, link 1.54 / 6.55; 80% text 4.36 / 7.86, link 3.00 / 5.42; 90% text 5.44 / 7.24, link 3.75 / 4.99; 100% text 6.70, link 4.62, whatever is behind and blur or not. Midnight (bubble #0a090e, text #aeccff, link #609385) at 54%: over black text 12.49, link 5.83; over white text 2.62, link 1.22. White is not in the night scene, and 4.5:1 over the horizon glow is still an estimate, not measured.
Tests: scene directory 262 pass, full suite 472 pass. No test pins the colour.
Open:
onContextLost(host.ts:28, Terrain.ts:364) is an open follow-up. Reduced-motion, webgl2-off and real-GPU probes remain unverified. Not merged.Update: head
78a7dbe9Delta over
b13bb9ecis one commit, one line of value: the login card fill insrc/app/pages/auth/styles.css.tsgoes from 50% to 54% (both the rgba fallback and the color-mix), so 4.5:1 holds over the horizon glow without depending on backdropFilter. The comment above it is reworded to match. Nothing else changed.src/app/features/scene; the full suite is 472 passing). The 298 quoted below was not reproduced at either scope.Carries the whole terrain stack (24 commits over the merge base: scatter sky, albedo, stars, haze, tier label), none of which is on
devyet. The change this PR is for is9b4d92c9.dev(9794714f) is merged in atb13bb9ec; the one conflict, index.html's manifest link (%BASE_URL%manifest.jsonhere,./manifest.jsonon dev, both base-relative), is resolved to dev's form. The PR is mergeable. Merging is not requested here.Cause
Phone shots of
terrain · lowshowed hard-edged facets on the near ground and stepped crests. The grid (192 quads low, 256 full, about 7 m wide at the nearest ground) was coarser than the 2.9 m height texels the fragment shader takes its normals from, so gullies the polygons could not carry showed as hard shading edges.Measurements
Low tier rendered at 192..384 quads against a 768-quad reference, camera frozen, mean abs RGB error on the day frame: 192 → 1.68, 256 → 1.06, 320 → 0.71, 384 → 0.47 (night 2.10 / 1.31 / 0.89 / 0.60). The warp's shape made no measurable difference.
Fix (
9b4d92c9)terrainWorld.test.tsgoes from 80k to 210k (205k used).Verification
/opt/commons/handoff/rat-terrain-mesh-20261109/(before left, after right in the side-by-sides).Unverified
🤖 Generated with Claude Code
scatter.js ray-marches a single-scattering Rayleigh+Mie atmosphere whose vertical optical depth is sun.js's TAU, and bakes two tables into baked.scatter: transmittance to space by view elevation (32x1) and sky radiance by azimuth from the sun x view elevation x sun elevation (7x32x12), RGB half floats, little-endian base64, value x 64. Layout, exact decode and a GLSL sampler are in src/sky/README.md. Tests pin layout, encoding, checksums and physical anchors (zenith transmittance equals exp(-TAU); blue noon, red low sun toward the sun, black below the planet-shadow limit). The per-sky sun {elevation_deg, azimuth_deg, color_linear}, ambient_linear and horizon_hex were already baked in7216456a; sun.js now exports TAU. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>0386065f) into scene-terrain-scatter f1d8db0c61Drops the vendored terrain/skyData.ts and the computed azimuth. terrainSky.ts reads src/sky/baked.ts: sun {elevation_deg, azimuth_deg, color_linear}, ambient_linear, horizon_hex. terrainScatter.ts decodes baked.scatter and uploads sky_view as an RGB16F 3D texture; SKY_FRAG and GRID_FRAG sample it (README sampler), the sky for the view ray, the haze for the horizon in the fragment's azimuth. - Sky: 1 - exp(-exposure * radiance) + night glow (midnight horizon colour, off as the sun nears the horizon) + sun disc; +-0.5/255 dither on the 8-bit output. - Stars fade by sun elevation (starGain: 1 below -12, 0 above -6) instead of a dark-sky gate; the field is placed against the midnight gradient. - ?sun=<deg>&az=<deg> (or the sun option) lights between the two bakes for dusk (skyAtSun). - Changed numbers, noted in scene/README.md: haze colour is the scattered sky (was the gradient's horizon stop), ambient is ambient_linear as baked (was gradient zenith x 0.25 x night lift up to 4), HAZE_K unchanged at 0.0004. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>9794714f) into nibu/scene-terrain-scatter-dev