feat(shaders): draw a mesh with Godot's unshaded scene template #1986
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.48) × (1 − Review Confidence (0.38)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 557 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 63% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.378
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #1986"
general
weight: 0.35
claude[bot]
Godot measurement
Godot 4.6.3 and the port draw the same pixels for Godot's default spatial shader with
render_mode unshaded. Both scenes are 64 by 64 pixels, and the port matches Godot at 0/255 on all 4,096 pixels of each.| Scene | Mesh | Camera | Pixels over 0/255 |
| --- | --- | --- | --- |
|
spatial-default-unshaded| A quad at the origin | Straight on | 0 of 4,096 ||
spatial-unshaded-moved| The quad moved by (0.3, -0.2, -0.5), rotated by (20°, 35°, -10°) and scaled by (1.4, 0.6, 1) | Turned | 0 of 4,096 |Godot draws each scene in a SubViewport with a Camera3D and a MeshInstance3D. The mesh is an ArrayMesh with no compression flags, and its material is a ShaderMaterial with Godot's default spatial shader.
The test can fail. When the instance basis is written by columns, not by rows, the moved scene has 212 pixels over 2/255, at most 127/255. Before this change, the unshaded variant did not link on WebGL 2.
The corpus has 5 more real shaders that transpile: 15 of 176, before 10. No shader moved back.
What changes
This is T13a of #1451, the first of three parts of T13 (#1831). It targets
feature/shader-translator.shaders/spatial/transpileSpatial.tslinks a spatial shader into the unshaded variant offorward_clustered/scene_forward_clustered.glsland builds one three.js node material from it.shaders/spatial/spatialBindings.tswrites the scene data and the instance data as Godot writes them, and gives the projection Godot's clip space correction.shaders/spatial/instanceData.tswrites the 44 words of Godot'sInstanceData. That includes the transposed 3 by 4 transform and the non-uniform scale flag.shaders/spatial/meshAttributes.tsadds Godot's two attributes to a geometry.godot/rendering/meshNormalTangent.tsencodes the normal and tangent as octahedrons, as Godot does. With no tangent array, it makes the tangent Godot makes. Its test holds the bytes Godot 4.6.3 writes for six vertices.shaders/template/blockLayout.tsplaces the members of a block with the std140 and std430 rules.shaders/template/rowTexture.tsreads a buffer block from an RGBA32UI texture at its offsets, because WebGL 2 has no storage buffers.shaders/template/globalParameters.tspasses each global that a function writes as aninoutparameter, because three's functions read only their parameters.shaders/template/squareMatrices.tsholds a non-square matrix as a square one.shaders/language/subgroupComposites.tsreads each subgroup operation as a subgroup of one lane.shaders/spatial/joins the transpiler's paths inscripts/ci/shaderScope.mjs.Boundaries
These parts of #1831 are in the next two PRs:
flatandsmooth), the branch rows and the built-in rows.installGodotShading(renderer),ref:diff --lit-surface nodes, the render mode and stencil mode rows.These are cuts in this PR. Each is visible here so that it is not lost:
prev_dataunset, where Godot writes the previous frame's data. Motion vectors need it, and the unshaded colour does not read it.transpileSpatial,writeSpatialBindingsandwriteSpatialInstanceare provisional untilinstallGodotShadingin T13c.How you checked it
pnpm test:shaders:e2e --update: both mesh scenes at 0/255 on all pixels, and every sky scene stays within 1/255.pnpm vitest run apps/textscene-three-godot-shaders: 8,484 tests pass.pnpm godot:shader-languageis up to date.pnpm comments:check --base origin/feature/shader-translator, ESLint,tscand the pre-push checks pass.Review findings
| Finding | Handling |
| --- | --- |
| Pre-push: three exports had only test readers | Fixed: they are module-private |
| Pre-push:
shaders/spatial/imported the transpiler from outside its paths | Fixed: the folder is one of the transpiler's paths |Part of #1831.
---
_Generated by Claude Code_