BDS client: RenderCheck for the PS1 kit, a mutant per claim, README for the live machine
RenderCheck reads real frames at a pinned tick: 15-bit colour, one colour per block, the vertex snap against the CPU-projected hull on a coarse grid, affine texel runs on a checker triangle at 60 degrees, the chamber's glow lighting the figure, the figure at the lanes' origins. render-mutants.sh breaks the shipped look once per claim (post off, block off, snap off, perspective UVs, glow unset, carriers unposed) and wants that claim's line to fail; every one does. Bounds from deterministic-bound-margin, readings in their comments. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
20c2ed73ae
commit
21fb7bd37b
4 changed files with 416 additions and 17 deletions
42
README.md
42
README.md
|
|
@ -64,43 +64,51 @@ session, `BodyPainBoxSession` (create, `Step`, read `Hand` and the world's lanes
|
|||
`client/` is a Godot 4.7.2 (mono) project that renders the body run and takes the player's commands: the
|
||||
Synaptic Induction Chamber, the dummy strapped to a stool with its right hand in the box. It owns presentation and
|
||||
input only. Godot's physics engine is set to Dummy; each 120 Hz physics frame the client calls
|
||||
`BodyPainBoxSession.Step()` once and draws Ymir's lanes: one pose-carrying node per stable id, and the body drawn as one
|
||||
skinned SDF mesh (a surface-nets isosurface of the shape lanes, limbs smooth-blended into the body they hang from and
|
||||
joined by a ball at each joint, built once at startup and rebuilt only when the bodies or joints change; skinned on the CPU every frame by `PuppetSkin`, which derives the facets, creases, vertex normals and altitudes from the skinned surface; flat-shaded, each edge softened by a bevel 2 px wide (`Look.BevelScreen`, at least `Look.BevelMin`, question lodur:question:bds-puppet-bevel-look-width): the fragment shader tilts the facet normal to each edge's bisector and blends corners to the vertex normal). The puppet is glazed porcelain: a bisque lit by a studio (a shadowing key and two rims, `Look.Studio`) that the camera carries (lodur:ruling:porcelain-studio-follows-camera), plus an analytic glaze that reflects the same studio (`client/studio.gdshaderinc`, Fresnel times the studio in the reflected direction, added as emission so it draws the same under gl_compatibility), pooled darker in concave creases. The highlights are prefiltered where the shader decides them (geometric specular antialiasing, Tokuyoshi and Kaplanyan 2021): the spread of the shading normal over a pixel widens the studio the glaze reads, so a highlight does not crawl as the camera moves; the 3D draws with MSAA 4x (`rendering/anti_aliasing/quality/msaa_3d`) for silhouettes and triangle edges.
|
||||
`BodyPainBoxSession.Step()` once and draws Ymir's lanes: one pose-carrying node per stable id (`BodyRenderer`), each holding its body's own
|
||||
primitive (a capsule, box or sphere of the lane's size; the figure is a placeholder of primitives until the anatomy meshes come). The look is
|
||||
PlayStation-1-era 3D (lodur:ruling:bds-look-ps1-anatomy): every surface is `ps1.gdshader` (vertices snapped to the line grid, affine texture
|
||||
coordinates, unfiltered texels, light, glow and fog per vertex, in raw sRGB arithmetic), and `ps1_post.gdshader` on a full-screen rect under the
|
||||
HUD quantises the frame to one colour per block of a 240-line grid (`Look.Lines`, blocks of round(H / 240) pixels anchored at the screen centre)
|
||||
in 15-bit colour with the 4x4 ordered dither. No `Light3D` exists: the shader lights the scene from the globals `ps1_*` (`project.godot`
|
||||
`[shader_globals]`), which `Look` (constants), `Main` (`ps1_res`) and `Chamber` (the glow light, 0.9 m range) write.
|
||||
Needs the .NET 8+ SDK, cmake and a C compiler (MinGW gcc on Windows), the sibling Lodur, Ymir (with joint origin lanes, ABI 8) and CultLib
|
||||
checkouts (`..\Lodur`, `..\Ymir`, `..\CultLib`, or `LODUR_ROOT`, `YMIR_ROOT` and `CULTLIB_ROOT`; CultLib must be a clean checkout of
|
||||
checkouts Ymir builds against (`..\Lodur`, `..\Ymir`, `..\CultLib`, or `LODUR_ROOT`, `YMIR_ROOT` and `CULTLIB_ROOT`; CultLib must be a clean checkout of
|
||||
42dce361, the revision Ymir admits, or the build refuses), and Godot 4.7.2 mono.
|
||||
|
||||
```
|
||||
dotnet build client/BadDay.Client.csproj # CultLib Geometry, Lodur, Ymir (cmake) and BDS, plus ymir_box3d.dll, into client/.godot/mono/temp/bin/Debug
|
||||
dotnet build client/BadDay.Client.csproj # Lodur, Ymir (cmake, CultLib) and BDS, plus ymir_box3d.dll, into client/.godot/mono/temp/bin/Debug
|
||||
<godot> --path client # play: Blender's navigation: middle-drag orbits the puppet, Shift+middle-drag pans, Ctrl+middle-drag and the wheel zoom; Alt+left-drag stands for the middle button (OrbitCamera.Emulate3ButtonMouse)
|
||||
<godot> --headless --path client res://tests/Smoke.tscn # the smoke; exit code 0 passes
|
||||
<godot> --path client res://tests/RenderCheck.tscn # the render check, in a window (not headless); exit code 0 passes
|
||||
<godot> --path client res://tests/RenderCheck.tscn # the render check, in a window (not headless); exit code 0 passes; -- --frames=<dir> keeps its frames
|
||||
bash client/tests/render-mutants.sh # breaks the look once per claim; each break must fail its line
|
||||
```
|
||||
|
||||
Or open `client/project.godot` in the Godot editor, Build, Play. The HUD has Reset with a seed, a live intensity
|
||||
slider, Box off and Slow motion. Do not run `godot --import` on a fresh checkout; a plain run creates `.godot`.
|
||||
Exports need export templates (not installed here yet), so the client runs from the editor and headless for now.
|
||||
|
||||
The smoke has no renderer. `RenderCheck.tscn` is the check that does: it poses the puppet in a bent pose under a moved parent, renders one frame
|
||||
(gl_compatibility, the client's renderer), and compares the drawn silhouette with the mesh skinned on the CPU (intersection over union, at
|
||||
least 0.999: a correct render measures 1.0000, and a forearm bone 10 degrees off, a bone 2 cm off and hard weights fail), and checks the bisque (the glaze off) is not clipped to white and that the chamber's light still lights it (a glow of 0 fails); with the glaze on at the close view, from the front and from behind, the glaze must change at least 3% of the puppet's pixels and, from the front, clip at most 12% (add `-- --glaze-png=<path>` or `--glaze-behind-png=`). It also draws the shading normal (the soft bevel) on the torso and compares it with a CPU reference of the whole formula, skinned, welded and derived by the check itself, in five views: close up and from 3.7 m at 1280x720, close up in a bend of 90 degrees, and at 1920x1080 from 2.2 m and from 3.7 m (so a width fixed at 720 lines fails). In each: 90th percentile error at most 2 degrees, 0.6 across the bevel band, 1.5 on triangles whose width the smallest altitude caps, at most 0.7 on the pixels the corner blend reaches (the smooth vertex normal, in view space, within 1.5 widths of a corner) and at most 1.5 on the band of edges turning by 115 to 137 degrees (a bevel that is off, a stale crease, a linear falloff, a missing edge strip or width cap, the wrong width, a vertex normal left in model space, a shorter corner reach and a lower crease clamp fail). The drawn normals across triangle boundaries stay continuous: at most 0.5% of adjacent pixel pairs over 30 degrees at a bend of 60 degrees and 3% at 90, where some edges fold past 120 degrees and 2 px cannot soften them. The oracle frames above are drawn with MSAA off (they check the shader's own pixels). Last, the flicker check draws the glaze with the project's MSAA from 16 sub-pixel camera shifts in seven framings in the pose the player sees (five at 2.4 m, FOV 55, the first being where the orbit camera starts, and two at 0.7 m) and in three of them with the puppet bent 30 and 60 degrees, against the same shifts drawn 8 times the window's size, MSAA off, and box-filtered down in linear light. On the pixels the puppet covers fully, the 99th percentile of the per-pixel luma standard deviation over the shifts must stay within 1.45 (1.33 close) times the reference's and the mean luma of the reference's highlights (245 or more) within 1.5 levels of the reference's (a glaze that crawls, or one blurred away, fails); on the silhouette's ring the mean distance from the reference must stay under 22 levels (the 3D without MSAA fails); and under a slow orbit (30 frames of 0.15 degrees at the shipped framing) the error against the reference, differenced twice in time over the halo of the highlights, must average at most 8 levels (the shipped glaze 5.6, an unfiltered one 10.5). The whole check takes about 2 minutes on a GTX 1070. Add `-- --png=<path>`, `-- --normals-png=<path>` or `-- --normals-far-png=<path>` (also `--normals-bend90-png=`, `--normals-mid-png=`, `--normals-far1080-png=`) to keep a frame. It needs a display.
|
||||
Known gap: the culling box. `Puppet` sets the mesh's `CustomAabb` to the skinned bounds every frame; a 1 cm box at the origin or at the centre culls the puppet in the close view and fails, but a box of half the bounds around the centre passes, since it only drops limbs where the box leaves the screen, which no view samples.
|
||||
The smoke has no renderer. `RenderCheck.tscn` is the check that does: it renders real frames (gl_compatibility, the client's renderer at 1280x720)
|
||||
of seed 1 stopped at a pinned tick and reads them back, so every reading is the same run to run. It checks that every channel is a multiple of 8 (15-bit
|
||||
colour), that every block of the grid is one colour, that a probe box's drawn blocks are those of its hull with the corners snapped to a coarse grid (the
|
||||
unsnapped hull differs in 8 blocks), that the texel runs of a checker triangle seen at 60 degrees keep equal widths along a scanline (affine), that the
|
||||
chamber at full glow lights the figure by at least 1.2 levels over dark, and that each dynamic body's lane origin projects onto a figure pixel. Bounds sit
|
||||
at the midpoint of the shipped worst and the least claimed mutant (`lodur:ruling:deterministic-bound-margin`), each stated in its comment;
|
||||
`client/tests/render-mutants.sh` applies one edit per claim (post off, per-pixel blocks, snap off, perspective-correct UVs, glow unwritten, carriers
|
||||
unposed) and wants that claim's line to fail. It needs a display.
|
||||
|
||||
|
||||
### Who owns what (the map)
|
||||
|
||||
The client's puppet pipeline, one owner per decision (the paragraphs above say how it looks; this says who may write what):
|
||||
The client's drawing pipeline, one owner per decision (the paragraphs above say how it looks; this says who may write what):
|
||||
|
||||
| Owner | Inputs | Outputs | Derived state | Forbidden writers |
|
||||
|---|---|---|---|---|
|
||||
| Ymir (the session's world, ABI 8) | the session's commands and Lodur's torque lanes | pose, shape, stable-id and joint lanes, including each joint's origin in the world (the joint origin lanes) | none the client keeps | the client writes no lane; Ymir never reads the client |
|
||||
| `PuppetField` (`Build`: the mesher, untangle included) | shape bodies (id, kind, size, bind pose), qualifying joints (kind, body A, body B, origin in A's frame), the `Look` blend constants, the cell | `PuppetShape`: the welded vertices (each once, with its two bones and weight), triangles as `Corners`, edge pairing as `Across`, the untangle's `Pulled` and `OffSurface` | nothing: a pure, engine-free function of its inputs | anything that reads lanes, Godot types, a call per frame |
|
||||
| `PuppetModel` | `Box3DSoaView` (kind, size, stable id, pose, joint kind, bodies and origins), read by `Lanes` | the current `PuppetShape`, and whether this update rebuilt it | the bind (each body's pose the first time it is seen), each joint's origin kept in body A's frame from the origin lane at first sight, the topology signature (ordered id, kind and size of the shape bodies; ordered kind, A and B of the qualifying joints) | `Puppet` or the scene deciding when to rebuild; a pose or an origin alone causing a rebuild |
|
||||
| `PuppetSkin` (one per shape) | the shape and one `Rigid` per bone, every frame | `Skinned`, `Facet`, `Crease`, `VertexNormal`, `Altitude`, `SmallestAltitude`, `Lo` and `Hi` | all of it, every frame, from the deformed surface; nothing kept from the bind; buffers allocated once | the shader, `Puppet` or RenderCheck deriving a facet, crease, vertex normal or distance of their own |
|
||||
| `Puppet` | the lanes (a carrier per stable id, posed each physics frame), the model's shape, the skin's arrays | the Godot mesh (two streams uploaded in place each frame), `CustomAabb`, `MeshBuilds` | the build counter, the client's only one: it counts Godot mesh builds | geometry derived here; a second build counter; writing a lane |
|
||||
| `puppet.gdshader` | `CUSTOM0..3` (altitudes, creases, facet normal, vertex normal), `Look.BevelScreen` and `BevelMin` | the shading normal (the bevel) and the colour | none | skinning, evaluating the SDF, owning a width or a crease |
|
||||
| `tests/RenderCheck.cs` (the windowed oracle), `PuppetChecks.cs`, `Smoke.cs` | the same lanes through the real renderer, and an independent CPU reference of the whole bevel | an exit code, optional PNGs | none | writing the puppet's state; sharing `PuppetSkin`'s derivation (the reference derives its own) |
|
||||
| `BodyRenderer` | the lanes (kind, size, stable id, pose), each physics frame | one carrier per stable id with one primitive `MeshInstance3D`; `PoseOf`, `InterpolatedPoseOf`, `PuppetCentre` (the union of the dynamic bodies' carrier-placed primitive boxes), `MeshBuilds` | `MeshBuilds`, the smoke's counter: a Reset with the same ids makes no mesh | geometry derived from anything but the lane's size; writing a lane |
|
||||
| `ps1.gdshader` | `Look`'s numbers and the `ps1_*` globals, the mesh's vertices, normals and UVs | every surface's colour: snapped vertices, affine texels, per-vertex light, glow and fog | none | skinning; a second light model; a `Light3D` |
|
||||
| `ps1_post.gdshader` | the frame and `ps1_res` | the framebuffer at the line grid in 15-bit colour with the dither | none | a second resolution owner (viewport scaling, stretch mode, a SubViewport) |
|
||||
| `Look`, `Main`, `Chamber` | `Look`: constants and textures; `Main`: the window size; `Chamber`: the box's intensity | `Look`: the constant globals and `Look.Ps1` materials; `Main`: `ps1_res` and the post layer; `Chamber`: `ps1_glow_*` | `ps1_res` is the window over `Look.BlockSize`, never set elsewhere | any other writer of a `ps1_*` global |
|
||||
| `tests/RenderCheck.cs` (the windowed check), `render-mutants.sh`, `Smoke.cs` | the same lanes through the real renderer | an exit code, optional PNGs | none | writing the scene's state beyond pinning a tick and a probe |
|
||||
|
||||
The scenarios, one owner per decision:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue