The view: one WebGL2 ray-marcher, a template

this page as plaintext

view.js is the twin’s one voxel view: a per-pixel DDA over the cells as a 3-D integer texture, with the empty-space leaps by the worker’s block distance. A look’s features are resolved into the shader’s source at build, never a uniform branch (HLSL evaluates both sides of a logical operator and a ternary: the toy’s draw measured 204 ms against 135 with one feature merely switched off by a uniform, 2026-11-05).

The look

key type default
amb f32 0.38 the light a face turned from the sun keeps
sfloor f32 0.35 what a shadowed face keeps of the sun
edge cells 0.0 gas and liquid fade over this many cells toward the box’s faces (0: none)
grain f32 0.0 a solid cell’s albedo varies by this much (0: none)
soft 0 1 0.0
shadow 0 1 1.0
ao 0 1 1.0
water 0 1 1.0
heat 0 1 1.0
flicker 0 1 1.0
placed 0 1 0.0
scene 0 1 1.0

The shims

Each caller’s look, as its file sets it (a key absent keeps the default).

shim unroll amb sfloor edge grain soft shadow ao water heat flicker placed scene
the player yes 0.55 · · · · 0.0 0.0 0.0 0.0 0.0 0.0 1.0
the toy yes 0.38 0.35 · · · 1.0 1.0 1.0 1.0 1.0 0.0 1.0
the home no · 0.25 · · · 1.0 1.0 1.0 1.0 1.0 1.0 0.0
the comet no 0.16 · 6.0 0.2 1.0 · · · · · · ·
the system no 0.24 · 6.0 0.16 1.0 · · · · · · ·

The API

VS

VS

The vertex shader every view shares: a screen-filling triangle strip from gl_VertexID, its NDC passed on as v_ndc for the fragment shader to ray-march from.

starburn/crates/starlab-wasm/web/view.js:34

LOOK

LOOK

The look’s keys and their defaults (api.json’s look names each): the ambient and the shadow floor, the edge, grain and softness, the shadow, ambient occlusion, water, heat and flicker passes on or off, the placed-cell mark, the scene lighting. A view’s look: bag overrides them key by key.

starburn/crates/starlab-wasm/web/view.js:43

fsSource

fsSource(look, unroll)

The fragment shader’s source for a look (the features in the source or not) and a loop form.

starburn/crates/starlab-wasm/web/view.js:46

MAT_OF

MAT_OF

The material id of a packed cell word: its low four bits, plus sixteen when bit 6 (the high-material flag) is set, so the thirty-two slots of MATS are reached.

starburn/crates/starlab-wasm/web/view.js:287

voxelView

voxelView(gl, opts)

The view on a context. palette 32 [r,g,b] (0-255) or null; alphas 32 floats; look and unroll as above.

option type
palette 32 x [r, g, b] 0-255 a material’s colour
alphas 32 x f32 a material’s cover (1 = opaque)
look look the features, resolved into the shader’s source at build
unroll boolean constant loop bounds (a faster draw, a longer link) or loops through u_one

starburn/crates/starlab-wasm/web/view.js:290

placing

placing(place, dims)

A scene point to the grid’s cell coordinates and back, for the pick and the strikes (the same map as the shader’s).

starburn/crates/starlab-wasm/web/view.js:400

pickCells

pickCells(grid, dims, ro, rd, matOf)

The first cell a ray meets in the page’s copy of the grid (a DDA, as the shader’s), or null. ro/rd in grid space; matOf maps a word to its material (0 = air), so a mask is the caller’s (gas as air, say).

starburn/crates/starlab-wasm/web/view.js:413

draw(cam, place, light, canvas, frame, fade, skip)

option type
cam {eye, fwd, right, up, fov} fov in radians; grid space, or scene space when placed
place {origin, scale, axes} null
light vec3 a direction toward the sun
frame u32 the twin’s frame (flicker)
fade f32 a fade over the whole
skip boolean the empty-space leaps by the block distance

initView(canvas, palette, alphas, opts)

option type
skip boolean the leaps
timeAll boolean time every draw (the bench)
onSample function a timing sample

The materials

The engine names them (starlab-sim-core/src/materials.rs); the web colours the ones it draws (starlab-player.js MATS). Id 16 is the engine’s canary, unnamed.

id the engine the web colour
0 empty empty ·
1 sand sand #d6bd6f
2 water water #2f6fd1
3 lava lava #ff5a1f
4 stone stone #767c86
5 ice ice #bfe3ff
6 steam steam #c7d3e3
7 crystal crystal #b48cff
8 oil oil #2c2a26
9 fire fire #ffa726
10 soil soil #6b4a2b
11 acid acid #9ccc1c
12 flora flora #3fa34d
13 fauna fauna #f06292
14 spore spore #5a5f69
15 coral coral #ff8a80
17 ash ash #9a9a94
20 brick brick #b5532c
21 glass glass #9fd8d3
24 mud mud #4e3b2a
26 char char #1a1a1a
The work on this page: the commits of the last 30 days on its sources, the work open against them, its checks

  • starburn 87e5ac4 techno, the day after: a tempo that is a RATIO of steps (any beats a minute), a lane's ACCENT and ARRANGEMENT, the tempo and the lanes in the snapshot and the record; ABI id 3aa530db (2026-11-12, the tower)
  • starburn ec01144 techno T1: the lanes, rhythms that strike the sound plane on the world's tempo (both sim lanes, a saved world, a tape op, the reference and the browser twin); ★ the ABI id moves f9de7f70 -> d9103976; ★ T0's stated tempi corrected (the sim clock is 60 a second, not 33) (2026-11-12, the tower)

  • starburn fc074fc tape: one reader. The parser, its refusals and the applier are the core's tape module; the command and the browser module call it, and the two JavaScript walkers hold no checks of their own (dev loop S2; 2026-11-11, the tower)
  • starburn acbe7d0 wasm: the browser twin reads the tape's sound ops and holds sound_hash; a sound tape over a grid that is not whole lattice cells is refused (waves V2b; 2026-11-11, the tower)

  • starburn 0610b88 starlab-wasm web: words above the eleven exports that had none (view.js, starlab-player.js) (2026-11-09)
  • starburn cfcdc0f starlab-wasm web: every demo of api.json pins its digest at rest (2026-11-09)

  • starburn 35f5c51 starlab-wasm: api.json, the web engine's protocol table; words on the eleven undocumented exports; the web names material 14 as the engine does (D1 of the reference lane, 2026-11-05)
  • starburn 61c6d83 starlab-wasm web: view.js, the twin's ONE WebGL2 voxel view, a template; view3d.js a shim on it (2026-11-05)

  • starburn 2fa75d9 starlab-wasm/web: mountTape, the world tape played on the worlds page's player (the replay program's R7, 2026-10-30)

  • starburn 52161e9 starlab.replay/1, the recording (M4 of the cartridge program): world::write_replay_dir (the cells every K steps as frames/<frame>.png with replay.lua naming each frame's digest) and write_lua_canon (canon_lua's text byte for byte, held to three conformance goldens); starlab-replay record; the wasm module reads Lua data as JSON, decodes a grid PNG and hashes words (sl_lua_json, sl_grid_decode, sl_words_hash); the player's mountReplay scrubs a recording and hashes every frame back, mountRecord routes a replay record to it; the derived crate re-split
  • starburn fb9f0d0 starlab-player: mountRecord — the player alone on one sealed cart for /play/<record> (M4 of the cartridge program)
  • starburn 558be21 starlab-player.js: a page's block mounts once; the 3-D view and a block's start fail aloud in the slot, never as an uncaught exception
  • starburn 724186d starlab-wasm/web: the player as one module (starlab-player.js + its stylesheet) — mount on an element with a world's files and the cart's record: the 3-D view, play/step, the fingerprint, and the replay check against the record's witness ("replayed ×2" when the page's digest at the witness's frame equals the record's); mountBlocks for a page's figure.world blocks; the dev page rebuilt on it with a record check and a ?world=&check= deep link; web-sim.sh stages the exported showcase carts with their records

The work record as of , from the fold on tower.

Nothing open against these sources.

  • FAILlint/web-reference 12 Nov on tower

Generated by tools/reference_pages.py from starburn/crates/starlab-wasm/web/view.js, the shims, starlab-sim-core/src/materials.rs, web/starlab-player.js, web/api.json; the twin bfaad079a7ce (434093 bytes). The words are a draft.