Ratatoskr/harness/scene
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens 4597539976 Tests and look sheet follow the moment authority
Tests move to SkyChoice and the sun-taking makePhysicalSky; the harness sheet takes the six named moments
on both solstices (?named=1).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 23:36:08 +01:00
..
bundle.cjs Ridge scene: physical sky over Vienna, real horizon, live weather (Nibu) (#110) 2026-11-12 02:48:04 +00:00
demo.ts scene: half-float prepass start target where EXT_color_buffer_float is missing; say why createScene is null 2026-11-04 20:39:22 +00:00
drive.cjs harness: trace and diff modes, standalone demo page with steps/pixel readout 2026-11-04 18:26:23 +00:00
entry.ts Background scene: two-pass WebGL2 terrain and world tree with login pull-back 2026-10-31 21:43:40 +00:00
gradAxis.cjs scene: terrainNormal reads the world-z slope from .y, not .z 2026-11-07 20:43:34 +00:00
README.md Tests and look sheet follow the moment authority 2026-11-20 23:36:08 +01:00
ridgeDemo.ts Ridge backdrop A+D: baked ridge planes over the live sky (Vienna) (#163) 2026-11-14 11:07:58 +00:00
ridgeSheet.html Harness: ridge look sheet (sky states x looks, four art-direction presets) 2026-11-20 14:46:56 +01:00
ridgeSheet.ts Tests and look sheet follow the moment authority 2026-11-20 23:36:08 +01:00

Scene harness

Compiles, renders and times the background scene (src/app/features/scene/) in headless Chromium. Not shipped, not run by CI.

node bundle.cjs <outdir>                  # esbuild bundle of entry.ts plus an index.html
node drive.cjs <outdir> compile           # compile and link each stage, JSON report
node drive.cjs <outdir> shots <pngdir>    # rest, mid pull-back and pulled-back screenshots
node gradAxis.cjs <shaders dir>           # numeric check that noise gradients are (d/dx, d/dz-as-.y, ...): terrainNormal axis
node drive.cjs <outdir> measure           # GPU time per pass by timer query, two viewports, two levels
node drive.cjs <outdir> variants          # the same with source patches (no erosion, no tree, value-only fbm)
node drive.cjs <outdir> trace             # mean trace steps per pixel and pass ms at three camera poses, PREPASS=0,1 arms
node drive.cjs <outdir> diff <pngdir>     # one frozen frame with and without the prepass, pixel diff and both PNGs
node drive.cjs <outdir> phacelle          # the Phacelle gradient probe behind world.ts `phacelleGradBound`

Needs esbuild and playwright@1.48.2 on NODE_PATH and a Chromium. The first run was done on a host with no GPU, so drive.cjs launches with --use-angle=swiftshader (software Vulkan). On a machine with a GPU, remove those flags to measure the real device. bundle.cjs must run from a directory whose ancestors hold no empty package.json (esbuild reads them).

Timings from SwiftShader are CPU time: use them for the split between passes and for before and after of one change, never as a phone frame time.

Ridge look sheet

Renders the Vienna cards (public/ridge/vienna-6815bb9dca99) lit for six sky states (dawn 2, morning 15, noon 55, golden 6, dusk -3, night -30 degrees of sun) by a set of looks (RidgeLook, src/app/features/scene/ridge/lightCards.ts, the one owner of look values), one 480x270 canvas per cell at heading 0. The sky behind a cell is the app's own (makePhysicalSky + paintSky, upscaled), without the sun disc, stars or clouds. Not shipped.

npx vite --port 5199          # from the repo root; the app's vite config serves the page and public/
http://localhost:5199/harness/scene/ridgeSheet.html                # four presets x six skies
...ridgeSheet.html?preset=swiss                                    # one preset (physical|swiss|poster|painterly)
...ridgeSheet.html?looks=%5B%7B%22label%22%3A%22no-ink%22%2C%22inkScale%22%3A0%7D%2C%7B%22label%22%3A%22hazy%22%2C%22hazeScale%22%3A8%7D%5D
...?w=640                                                          # cell width

looks= is a url-encoded or base64 JSON array of {label, ...partial RidgeLook} and replaces the preset rows (inkKeep and reliefLight merge by key). A cell costs one WebGL2 context and a card decode, so the full sheet takes tens of seconds (much longer in a background tab).

Presets (PRESETS in ridgeSheet.ts; swiss and poster take every key not named from PHYSICAL_LOOK, the rest from DEFAULT_LOOK, the painterly cel look), chosen by reasoning, not by eye, for Self to tune:

preset values
physical PHYSICAL_LOOK (Lambert, no noise, sky haze, full ink)
swiss reliefLight {mix 0.7, azimuthDeg -45, elevationDeg 40}, contrastByDistance 0.9, hazeScale 6, hazeTint [0, 0.05, 0.25], nearWarm 0.5, inkScale 0.6
poster reliefWeight 0.15, cardToneStep 0.25, cardGradient 0.5, inkKeep {edge 0.25, occlude 0.9, crease 1}, hazeScale 4
painterly DEFAULT_LOOK: groundNoise 0.35, cloudShadows 0.5, nearWarm 0.6, hazeScale 2, inkScale 0.4, celBands 3, celSoftness 0.05, celAmbientAway 0.7
painterly-cel-2 / -3 / -4 painterly with celBands 2 / 3 / 4

Named moments (ridgeSheet.html?named=1): the six moments of the Sky menu (dawn, morning, noon, golden hour, dusk, night) at the baked place on the December and June solstices, drawn from momentFor as the app draws them (SKY_MOMENTS in ridge/skyMoment.ts is the table tuned by eye from this sheet). Night sets (ridgeSheet.html): ?moments=2026-11-24T22:00Z,2026-12-09T20:00Z pins explicit UTC moments (the sun, moon and stars are those of the moment); ?night=1 renders the next new moon, first quarter and full moon from today (&from=YYYY-MM-DD) at four hours each (&hours=18,21,0,4, UTC) plus deep dusk of the full-moon evening; &lines=1 draws the constellation lines (the Sky menu's hidden toggle). Use &w=300 for the 13-column set. The night look's knobs: NIGHT_LOOK in ridge/nightSky.ts (star point spread, contrast exponents, moon size, earthshine, line opacity), NIGHT_CEILING and SCOTOPIC in ridge/toneMap.ts, the night Budget (key, targets, partial adaptation).