@babylonjs-toolkit/agent 1.1.14 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/package.json +1 -1
- package/skills/bt-gauntlet/SKILL.md +48 -30
- package/skills/bt-gauntlet/references/critic-rubrics.md +2 -2
- package/skills/bt-gauntlet/references/loop-templates.md +2 -2
- package/skills/bt-gauntlet/references/spec-composition.md +2 -2
- package/skills/bt-gauntlet/references/target-images.md +6 -6
- package/skills/bt-gauntlet/references/unity-pipeline.md +480 -0
- package/skills/bt-gauntlet/references/workspace.md +6 -5
- package/skills/bt-gauntlet/references/blender-model-pipeline.md +0 -194
- package/skills/bt-gauntlet/references/unity-level-pipeline.md +0 -285
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
# Pipeline: `unity`
|
|
2
|
+
|
|
3
|
+
**Deliverable:** anything authored in Unity and shipped through the Babylon Toolkit exporter as interactive
|
|
4
|
+
glTF — a whole game level, or an individual asset in it. Baked GI, IBL, reflection probes, terrain, fog and
|
|
5
|
+
tonemapping for scenes; geometry, UVs, PBR maps, LODs and skinning for models.
|
|
6
|
+
|
|
7
|
+
> ### Unity is the content-creation tool and the asset manager. Blender is a tool inside it.
|
|
8
|
+
>
|
|
9
|
+
> There is **one** Unity pipeline. The entire Unity ecosystem — asset packs, importers, lighting, physics,
|
|
10
|
+
> the prefab workflow — is the authoring surface, and `extras.metadata.components` is what makes the exported
|
|
11
|
+
> glTF *interactive* rather than dumb geometry.
|
|
12
|
+
>
|
|
13
|
+
> **Blender is used for low-level model and asset creation and edits.** It does geometry, UVs, bakes, LODs
|
|
14
|
+
> and skinning — **in place**, for files that already live in the Unity project, so GUIDs and importer
|
|
15
|
+
> settings survive. Its job ends the moment the model is back in Unity. From there the model is simply an
|
|
16
|
+
> asset in a scene: it gets its materials, colliders, LOD group, rig and Babylon Toolkit components there,
|
|
17
|
+
> and it is judged there, lit by that scene. Blender **cannot** write components — those come from Unity,
|
|
18
|
+
> and only under a Pro licence.
|
|
19
|
+
>
|
|
20
|
+
> **The loop stays in Unity. Do NOT export every round.** Evidence is a Unity camera snapshot —
|
|
21
|
+
> `Camera.Render()` straight to a PNG from the locked camera. A bake → export → dev-server → browser round
|
|
22
|
+
> trip on every iteration costs minutes and tells the critic nothing extra about the art.
|
|
23
|
+
>
|
|
24
|
+
> **Export when you are ready** — the user's call, by prompt or from the Unity Export buttons: the whole
|
|
25
|
+
> scene as a **game level** (`selection == null`, full scene metadata), or one asset as an **asset
|
|
26
|
+
> container** (`selection != null`, components but no scene metadata). A model used in a level ships inside
|
|
27
|
+
> that level's export; there is nothing asset-specific to do for it. See § 6.B.
|
|
28
|
+
|
|
29
|
+
> **Required reading before round 1.** Fetch and read the Agent Reference's
|
|
30
|
+
> [Unity Exporter Instructions](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/unity-exporter-cli.md)
|
|
31
|
+
> in full — and, for any round that touches Blender, the
|
|
32
|
+
> [Blender Headless CLI Instructions](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/unity-blender-cli.md).
|
|
33
|
+
> Section numbers below (§4B, §8, §10 …) refer to whichever is named. Builder subagents must be given them
|
|
34
|
+
> too — a subagent does not inherit your context.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 1. Prerequisite gate — before round 1, and again on every resume
|
|
39
|
+
|
|
40
|
+
**A gauntlet that starts without these spends its whole budget polishing something that never exports.**
|
|
41
|
+
Run the gate, write the result to `_gauntlet/<name>/pipeline.md`, and refuse to start if it fails.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
unity command bt_status --project-path "$PROJ"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
| Must be true | Why it is fatal |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `pro : True` | **Community silently drops Terrain**, plus Rigidbody, Animator, AudioSource, NavMeshAgent, CharacterController, ParticleSystem, Canvas, VideoPlayer, **PostProcess volumes** and **LOD groups**. The export still succeeds and still writes scene metadata — it just quietly omits them. See §0. |
|
|
50
|
+
| An Editor is reachable | `unity command` needs a live Editor (§6). |
|
|
51
|
+
| **A graphics device is available** | In-loop evidence is a real Unity render. `-nographics` has **no** graphics device and cannot render, so this pipeline runs in **copilot mode** (a resident Editor) or batchmode *with* graphics — never `-nographics`. Verify on round 1 by taking one snapshot and confirming the PNG is non-empty. |
|
|
52
|
+
| All three packages installed | `com.unity.pipeline` + `org.khronos.unitygltf` + `com.babylontoolkit.editor` (§4.1). |
|
|
53
|
+
| Scene Exporter panel bootstrapped once, in a GUI session | Seeds layers, FreeImage, shader list and root namespace, and writes `package.json` (§5.1). **A cold machine that has never run the GUI cannot start a gauntlet.** |
|
|
54
|
+
| `npm install` run in the project root | Any build with `CompileProjectScript` needs the local `tsc` (§5.2). |
|
|
55
|
+
| `unity list --format json \| grep bt_` returns the eight `bt_*` commands | The shipped CLI bridge (`com.babylontoolkit.editor` 9.22.3+, §11). If empty: `recompile` + `recompile_status`. |
|
|
56
|
+
| `baking : False` | A lightmap bake in progress hard-blocks every export. |
|
|
57
|
+
|
|
58
|
+
The combined three-things check from §0, worth running verbatim:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
unity command eval 'string r = UnityTools.GetRootPath();
|
|
62
|
+
return "pro=" + ToolkitManager.IsPro()
|
|
63
|
+
+ " tsc=" + System.IO.File.Exists(System.IO.Path.Combine(r, CanvasTools.CVPanel.TscLocalPath))
|
|
64
|
+
+ " scene=" + UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().path;' \
|
|
65
|
+
--project-path "$PROJ"
|
|
66
|
+
# want: pro=True tsc=True scene=Assets/Scenes/<the one you meant>.unity
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Licence is a loop-card boundary, not a warning.** If `pro` is `False`, park immediately and tell the user
|
|
70
|
+
that a valid `Assets/[Config]/license.json` is required — the two service grant paths
|
|
71
|
+
(`HasActiveSubscription()`, `GenerateDeveloperLicense()`) are documented as **not live yet**.
|
|
72
|
+
|
|
73
|
+
**When Blender is in scope**, also check:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
blender --version
|
|
77
|
+
blender -b --factory-startup --python-exit-code 1 \
|
|
78
|
+
--python-expr "import bpy; print('bpy', bpy.app.version_string)"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### `pipeline.md` for this kind
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
# Pipeline — unity
|
|
85
|
+
Unity project : /abs/path/UnityProject
|
|
86
|
+
Editor mode : copilot (resident GUI) <- REQUIRED; -nographics cannot render
|
|
87
|
+
Editor version: 6000.5.10f1
|
|
88
|
+
Toolkit : 9.22.3 licence: professional
|
|
89
|
+
Scene : Assets/Scenes/Level01.unity <- authored, rendered and judged here
|
|
90
|
+
Export root : /abs/path/UnityProject/Export
|
|
91
|
+
Dev server : http://localhost:8888 (started via bt_devserver_start)
|
|
92
|
+
Player page : /index.html?scene=level01.gltf (needs a web-project build — § 6.B)
|
|
93
|
+
Bake tier : preview | production
|
|
94
|
+
Capture mode : unity-snapshot (in-loop) · export+browser (checkpoints only)
|
|
95
|
+
Checkpoints : round 1 calibration done [y/n] · last checkpoint round N
|
|
96
|
+
Blender : 5.1.2 (/Applications/Blender.app/Contents/MacOS/Blender) [if in scope]
|
|
97
|
+
Model assets : Assets/Models/mech.fbx — write mode IN PLACE, backup mech.fbx.bak
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
> **None of this survives a pause.** A resident Editor, a warm asset database and a running dev server are
|
|
101
|
+
> all session-scoped. On resume, re-launch and re-run the gate before touching anything.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 2. Build surface — the Unity scene
|
|
106
|
+
|
|
107
|
+
Everything runs against the **live active scene** through the CLI. The Editor keeps its in-memory state in
|
|
108
|
+
sync; raw file edits cannot.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
unity command eval_file /tmp/round-12-lighting.cs --project-path "$PROJ" --format json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> ⚠️ **Never hand-edit `.unity`, `.prefab` or `.asset` YAML while a live Editor is reachable.** fileIDs and
|
|
115
|
+
> GUIDs are easy to get wrong, the Editor will not see the change until a reimport, and it is very easy to
|
|
116
|
+
> write valid-looking YAML into the wrong scene. Only edit files directly when `unity status` /
|
|
117
|
+
> `unity command` show no reachable Editor — and say so explicitly in the round journal.
|
|
118
|
+
|
|
119
|
+
### The LightingSettings trap — round 1 must handle it
|
|
120
|
+
|
|
121
|
+
A scene created with `EditorSceneManager.NewScene` in batch mode has **no LightingSettings asset**, and the
|
|
122
|
+
export throws `Lightmapping.lightingSettings is null`. Worse, *reading* the property throws when unset, so a
|
|
123
|
+
plain null-check raises the very error it checks for. Probe with `TryGetLightingSettings`, and note the order
|
|
124
|
+
and the `MarkSceneDirty` — without it the assignment is never written to disk and the *second* export of that
|
|
125
|
+
scene fails, which reads as "the fix stopped working" (§8.1):
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
NewScene -> build hierarchy -> SaveScene -> assign LightingSettings
|
|
129
|
+
-> MarkSceneDirty -> SaveOpenScenes -> AssetDatabase.SaveAssets -> BuildProject
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
grep -n "m_LightingSettings" Assets/Scenes/Level01.unity
|
|
134
|
+
# bad: m_LightingSettings: {fileID: 0}
|
|
135
|
+
# good: m_LightingSettings: {fileID: 4890085278179872738, guid: 64c317a2..., type: 2}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Scenes authored in the GUI already have one.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 3. Blender — the low-level modelling tool
|
|
143
|
+
|
|
144
|
+
Used when a round needs geometry, UVs, bakes, LODs or skinning that Unity cannot do. **Its output is the
|
|
145
|
+
model back in the Unity project — nothing further.**
|
|
146
|
+
|
|
147
|
+
**The canonical invocation — use all four flags every time:**
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
blender --background --factory-startup --python-exit-code 1 \
|
|
151
|
+
--python /path/to/script.py -- arg1 arg2
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
> ⚠️ **A Python exception does not fail the process.** Blender prints the traceback and exits `0`. Without
|
|
155
|
+
> `--python-exit-code 1` the loop records a crashed round as a success and hands the critic stale evidence.
|
|
156
|
+
|
|
157
|
+
Introspect before relying on any operator — names moved in 5.x (`bpy.ops.wm.fbx_import` is native now):
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
print(sorted(n for n in dir(bpy.ops.export_scene) if not n.startswith('_')))
|
|
161
|
+
print(bpy.ops.export_scene.gltf.__doc__)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### In place vs. new file — the rule that protects the whole project
|
|
165
|
+
|
|
166
|
+
| | **Edit in place** (overwrite the FBX) | **Create a new model** (new path) |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| Unity GUID | ✅ preserved | ❌ new GUID |
|
|
169
|
+
| Existing scene / prefab references | ✅ all survive and pick up the change | ➖ referenced by nothing |
|
|
170
|
+
| Importer settings — rig, avatar, clips, scale | ✅ preserved (`.meta` untouched) | ❌ **reset to defaults** |
|
|
171
|
+
| Use for | iterating on an asset already in scenes | variants, LODs, experiments |
|
|
172
|
+
|
|
173
|
+
**A gauntlet iterates on the same asset for many rounds. In place is the default, and this is a hard rule:**
|
|
174
|
+
|
|
175
|
+
- **Always back up first** — the write is destructive: `cp "$FBX" "$FBX.bak"`.
|
|
176
|
+
- **Never delete-then-recreate.** Removing the file removes its `.meta`, destroying the GUID and breaking
|
|
177
|
+
every scene and prefab that referenced it. Overwrite the bytes; leave the `.meta` alone.
|
|
178
|
+
- A round that genuinely needs a new path (an LOD, a variant) must **copy the importer settings across** —
|
|
179
|
+
Unity will not (`unity-blender-cli.md` §8.3) — and say so in the round journal.
|
|
180
|
+
|
|
181
|
+
After every Blender write, refresh Unity and confirm the GUID survived:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
cp "$FBX" "$FBX.bak"
|
|
185
|
+
blender --background --factory-startup --python-exit-code 1 \
|
|
186
|
+
--python /tmp/round-07-bevels.py -- "$FBX" "$FBX" # same path in and out
|
|
187
|
+
unity command eval 'UnityEditor.AssetDatabase.Refresh(UnityEditor.ImportAssetOptions.ForceSynchronousImport); return "ok";' --project-path "$PROJ"
|
|
188
|
+
|
|
189
|
+
unity command eval 'string p="Assets/Models/mech.fbx";
|
|
190
|
+
var i=(UnityEditor.ModelImporter)UnityEditor.AssetImporter.GetAtPath(p);
|
|
191
|
+
return UnityEditor.AssetDatabase.AssetPathToGUID(p) + " rig=" + i.animationType + " scale=" + i.globalScale;' \
|
|
192
|
+
--project-path "$PROJ"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Conventions to preserve for BabylonJS:** ≤ 4 influences per vertex, weights normalised to 1.0, bone names
|
|
196
|
+
matching the Unity Avatar/Animator rig, and `add_leaf_bones=False` on FBX export.
|
|
197
|
+
|
|
198
|
+
**Textures are generated, not procedural.** Where the toolkit's `kie-image` MCP is configured, use
|
|
199
|
+
`generate_image` for albedo, normals, roughness masks and detail maps. Substituting procedural noise or flat
|
|
200
|
+
colours for maps the target needs is a gate failure, and the commonest reason an asset reads as plastic.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 4. Where the work is judged
|
|
205
|
+
|
|
206
|
+
In the **scene it belongs to**, from **locked cameras**, under a **frozen lighting rig**. For scene-level
|
|
207
|
+
work that is simply the level. For an individual asset it is the level the asset lives in — more truthful
|
|
208
|
+
than an artificial rig, because the model is lit by the lighting it will really have, next to the props it
|
|
209
|
+
will really sit beside. Use a dedicated lookdev scene only for a library asset with no home yet.
|
|
210
|
+
|
|
211
|
+
Locked cameras are real Unity cameras named `gauntlet_<slug>`, recorded in `cameras.md` with exact
|
|
212
|
+
transforms, fov and resolution — three to five, including a detail crop. They export with the level, so the
|
|
213
|
+
same viewpoints are available at a checkpoint. Changing the rig or the cameras mid-run is a loop card
|
|
214
|
+
amendment that resets the affected parts' score history.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 5. Part taxonomy — pick what is in scope
|
|
219
|
+
|
|
220
|
+
Round 1 records the checklist in `progress.md`. A job takes the scene block, the asset block, or both.
|
|
221
|
+
|
|
222
|
+
### Scene parts
|
|
223
|
+
|
|
224
|
+
| Part | Owns | Exported metadata it drives |
|
|
225
|
+
|---|---|---|
|
|
226
|
+
| **Landform & terrain** | heightmap, terrain layers, splat weights, trees/details | Terrain component (**Pro-gated**) |
|
|
227
|
+
| **Blockout & composition** | major masses, silhouette, sightlines, framing at each locked camera | geometry |
|
|
228
|
+
| **Set dressing & scatter** | props, clutter, decals, LOD groups | geometry, LOD (**Pro-gated**) |
|
|
229
|
+
| **Materials & surfacing** | albedo/roughness/metallic/normal, texel density, wear | materials, textures |
|
|
230
|
+
| **Light rig** | sun angle + colour temp, practicals, shadow distance and softness | `light`, `sunposition`, `sunrotation` |
|
|
231
|
+
| **GI / lightmap bake** | lightmapper, resolution, bounces, denoiser, AO, UV padding | `ambientlightmap`, `lightmaplevel`, lightmap textures |
|
|
232
|
+
| **IBL / skybox / ambient** | skybox material or cubemap, ambient mode/source, SH, sky reflections | `skybox`, `skyreflections`, `createpolynomials`, `ambientlighting`, `ambientskymode`, `ambientskysource`, `ambientskycolor`, `ambientgroundcolor`, `ambientlightintensity` |
|
|
233
|
+
| **Reflection probes** | placement, resolution, box projection, intensity | `reflectionprobeintensity` |
|
|
234
|
+
| **Atmosphere & fog** | fog type/mode/colour/density, height fog, volumetrics | `fogtype`, `fogmode`, `fogcolor`, `fogdensity`, `fogstart`, `fogend`, `fogvolumetric`, `fogbaseheight`, `fogmaximumheight`, `fogmeanfreepath`, `foganisotropy` |
|
|
235
|
+
| **Image processing** | exposure, tonemapping, gamma, clear colour | `exposure`, `tonemapping`, `gammacorrection`, `imageprocessing`, `clearcolor` |
|
|
236
|
+
| **Perf & budget** | draw calls, texture format, lightmap memory, render groups | `webptextures`, `ktxtextures`, `webplightmaps`, `ktxlightmaps`, `rendergroups`, `freezeactivemeshes`, `prewarmup`, `performancepriority` |
|
|
237
|
+
|
|
238
|
+
### Asset parts (Blender + Unity)
|
|
239
|
+
|
|
240
|
+
| Part | Owns | Where |
|
|
241
|
+
|---|---|---|
|
|
242
|
+
| **Silhouette & proportion** | primary forms, scale against reference, thumbnail readability | Blender |
|
|
243
|
+
| **Secondary forms** | panel breaks, bevels, boolean/remesh cleanup | Blender |
|
|
244
|
+
| **UVs & texel density** | unwrap, seam placement, uniform px/m, atlas packing | Blender |
|
|
245
|
+
| **Baked maps** | high-to-low normal and AO bakes, curvature, cavity | Blender |
|
|
246
|
+
| **PBR materials** | albedo, roughness, metallic, normal, AO | Blender → Unity materials |
|
|
247
|
+
| **Detail pass** | wear, edge damage, grime in crevices, micro-normal | Blender |
|
|
248
|
+
| **Topology & LODs** | tri budget, decimate chain, recalculated normals | Blender → Unity **LODGroup** (Pro-gated) |
|
|
249
|
+
| **Rig & skinning** | ≤ 4 influences/vertex, normalised weights, matching bone names | Blender → Unity Animator |
|
|
250
|
+
| **Unity assembly** | prefab hierarchy, materials assigned, colliders / physics proxies, LODGroup, Animator, Toolkit script components | **Unity** |
|
|
251
|
+
| **Integration** | scale, orientation, pivot, naming, `add_leaf_bones=False` | Blender + Unity importer settings |
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## 6. Verify recipe — the round's step 4
|
|
256
|
+
|
|
257
|
+
Two modes. **Almost every round uses mode A.**
|
|
258
|
+
|
|
259
|
+
### 6.A In-loop verification — Unity snapshot (the default, every round)
|
|
260
|
+
|
|
261
|
+
#### 1. Bake
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
unity command eval 'UnityEditor.Lightmapping.BakeAsync(); return "started";' --project-path "$PROJ"
|
|
265
|
+
unity command eval 'return UnityEditor.Lightmapping.isRunning;' --project-path "$PROJ" # poll to False
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Bake tiering is the dominant cost** now that the export is out of the loop. Converge on a **preview** tier
|
|
269
|
+
(low lightmap resolution, few bounces, fast/no denoiser); switch to **production** only for the final rounds
|
|
270
|
+
and the integration pass. Record the tier in `progress.md` and every round journal — *a preview-tier score is
|
|
271
|
+
not comparable to a production-tier score*, and the critic must be told which it is looking at. Skip the bake
|
|
272
|
+
entirely on rounds that change nothing GI-dependent (a roughness tweak, a prop move) and say so.
|
|
273
|
+
|
|
274
|
+
#### 2. Snapshot the locked camera
|
|
275
|
+
|
|
276
|
+
Render the actual camera through the actual pipeline, straight to a PNG. No export, no server, no browser.
|
|
277
|
+
|
|
278
|
+
```csharp
|
|
279
|
+
// eval_file: snapshot one locked camera to disk
|
|
280
|
+
string camName = "gauntlet_hero";
|
|
281
|
+
string outPath = "/abs/_gauntlet/<name>/evidence/round-12-p7-hero.png";
|
|
282
|
+
int w = 1920, h = 1080;
|
|
283
|
+
|
|
284
|
+
var go = UnityEngine.GameObject.Find(camName);
|
|
285
|
+
if (go == null) throw new System.Exception("locked camera missing: " + camName);
|
|
286
|
+
var cam = go.GetComponent<UnityEngine.Camera>();
|
|
287
|
+
|
|
288
|
+
var rt = new UnityEngine.RenderTexture(w, h, 24, UnityEngine.RenderTextureFormat.ARGB32);
|
|
289
|
+
rt.antiAliasing = 8;
|
|
290
|
+
var prevTarget = cam.targetTexture; var prevActive = UnityEngine.RenderTexture.active;
|
|
291
|
+
cam.targetTexture = rt;
|
|
292
|
+
cam.Render();
|
|
293
|
+
UnityEngine.RenderTexture.active = rt;
|
|
294
|
+
var tex = new UnityEngine.Texture2D(w, h, UnityEngine.TextureFormat.RGB24, false);
|
|
295
|
+
tex.ReadPixels(new UnityEngine.Rect(0, 0, w, h), 0, 0);
|
|
296
|
+
tex.Apply();
|
|
297
|
+
UnityEngine.RenderTexture.active = prevActive; cam.targetTexture = prevTarget;
|
|
298
|
+
System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(outPath));
|
|
299
|
+
System.IO.File.WriteAllBytes(outPath, tex.EncodeToPNG());
|
|
300
|
+
UnityEngine.Object.DestroyImmediate(tex); rt.Release(); UnityEngine.Object.DestroyImmediate(rt);
|
|
301
|
+
return "wrote " + outPath + " bytes=" + new System.IO.FileInfo(outPath).Length;
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Repeat per locked camera. **Check the returned byte count** — a zero-length or tiny PNG means no graphics
|
|
305
|
+
device (§ 1), not a dark scene.
|
|
306
|
+
|
|
307
|
+
#### 3. Collect what Unity can measure
|
|
308
|
+
|
|
309
|
+
Into `evidence/round-NN-<part>-metrics.json`, via `UnityEditor.UnityStats` after the render: `drawCalls`,
|
|
310
|
+
`batches`, `setPassCalls`, `triangles`, `vertices`, lightmap count and memory — and, for asset parts,
|
|
311
|
+
triangle/vertex counts, material and texture counts, texture memory, texel density, max influences per
|
|
312
|
+
vertex, whether weights normalise to 1.0, LOD chain ratios. These are **Unity-side indicators, not the
|
|
313
|
+
BabylonJS perf gate**; they catch a scene going wildly heavy, they do not predict browser FPS.
|
|
314
|
+
|
|
315
|
+
That is the whole in-loop verify. Seconds, not minutes.
|
|
316
|
+
|
|
317
|
+
### 6.B Checkpoint verification — export + browser (rare, deliberate)
|
|
318
|
+
|
|
319
|
+
Run a checkpoint **only** at round 1 (calibration — proves the chain works before investing 40 rounds, and
|
|
320
|
+
records what actually crosses the export boundary), and when the work is done. An optional every-N cadence
|
|
321
|
+
exists; set it in the loop card, **off by default**.
|
|
322
|
+
|
|
323
|
+
**What you export is the user's call — by prompt, or from the Unity Export buttons.**
|
|
324
|
+
|
|
325
|
+
#### Game level (the default)
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
unity command bt_export_level --scene Assets/Scenes/Level01.unity --project-path "$PROJ" --timeout 900
|
|
329
|
+
unity command bt_devserver_start --project-path "$PROJ"
|
|
330
|
+
jq '.scenes[0].extras.metadata
|
|
331
|
+
| {license, skybox, ambientlighting, ambientskymode, ambientlightmap, lightmaplevel,
|
|
332
|
+
reflectionprobeintensity, exposure, tonemapping, fogmode, fogvolumetric, sunposition}' \
|
|
333
|
+
"$PROJ/Export/scenes/level01.gltf" > evidence/checkpoint-NN-metadata.json
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
`selection == null` gates the **entire scene-metadata block** — skybox, ambient/IBL, SH, reflection probe
|
|
337
|
+
intensity, fog, tonemapping, exposure, gravity, navmesh, sun position: 73 keys versus a container's 23 (§10).
|
|
338
|
+
**Any asset in the scene ships inside this export**, with its components, lit by the baked lighting. Nothing
|
|
339
|
+
asset-specific is required.
|
|
340
|
+
|
|
341
|
+
#### Asset container (when you want one)
|
|
342
|
+
|
|
343
|
+
For a standalone reusable asset — a prop instantiated many times at runtime, or one shared across levels:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
unity command bt_export_prefab --paths "Props/Mech" --filename mech \
|
|
347
|
+
--folder "$PROJ/Export/containers" --metadata true --project-path "$PROJ"
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
`selection != null` means **no** scene metadata, `PrefabFileFormat`, and it writes straight into the folder
|
|
351
|
+
given with no `scenes/` subfolder. Correct for a container; wrong for anything meant to carry a scene look.
|
|
352
|
+
|
|
353
|
+
#### Either way
|
|
354
|
+
|
|
355
|
+
- **`metadata: true` is what makes the output interactive** — it emits `extras.metadata.components`. Set it
|
|
356
|
+
`false` only for pure geometry or animation-only exports. Which components survive is **licence-gated**.
|
|
357
|
+
- Scene metadata is at `scenes[0].extras.metadata`; per-object components at
|
|
358
|
+
`nodes[i].extras.metadata.components`. Neither is at the document root.
|
|
359
|
+
- **Always pass `--scene`** on a level export. A fresh Editor session opens the *template's* default scene
|
|
360
|
+
and would silently export that one (§8.1).
|
|
361
|
+
- `bt_export_level` throws on `EditorApplication.isCompiling` and on `Lightmapping.isRunning`.
|
|
362
|
+
- `BuildProject` calls `SaveOpenScenes()` and `SaveSettings()` — **anything you toggle in memory is persisted
|
|
363
|
+
to disk.** Snapshot and restore, as the shipped bridge does for `geometryOnly`.
|
|
364
|
+
- ⚠️ `bt_export_level` defaults to `--geometryOnly true`, which skips the web-project emit — so
|
|
365
|
+
`/index.html` 404s. Run `bt_build_project` (or `--geometryOnly false`) once so the player page exists, or
|
|
366
|
+
point your own BabylonJS loader at the raw `scenes/*.gltf` URL. Decide at the round-1 checkpoint and record
|
|
367
|
+
it in `pipeline.md`.
|
|
368
|
+
|
|
369
|
+
| URL | Serves |
|
|
370
|
+
|---|---|
|
|
371
|
+
| `http://localhost:8888/index.html` | the generated web project, default scene |
|
|
372
|
+
| `http://localhost:8888/index.html?scene=level01.gltf` | the player pointed at one scene (**file name, not a path**) |
|
|
373
|
+
| `http://localhost:8888/scenes/level01.gltf` | the raw exported asset |
|
|
374
|
+
| `http://localhost:8888/containers/mech.glb` | an asset container written to an explicit folder |
|
|
375
|
+
|
|
376
|
+
### 6.C What the Unity snapshot cannot tell you
|
|
377
|
+
|
|
378
|
+
The honest reason checkpoints exist at all:
|
|
379
|
+
|
|
380
|
+
- **It renders through Unity's pipeline, not BabylonJS.** A URP/HDRP frame is not what the toolkit runtime
|
|
381
|
+
produces. In-loop scores measure "is the Unity scene right", the correct question while authoring — only a
|
|
382
|
+
checkpoint answers "does it survive export". Material translation is where an *asset* most often diverges.
|
|
383
|
+
- **Browser perf and load time** are unmeasurable in Unity. `UnityStats` draw calls are an indicator.
|
|
384
|
+
- **Console errors** in the toolkit runtime only appear in the browser.
|
|
385
|
+
- **Whether components actually exported** is only visible in the emitted glTF.
|
|
386
|
+
|
|
387
|
+
So: parts pass on Unity evidence for the **visual rubric**; the **perf, console, component and
|
|
388
|
+
export-boundary gates** are evaluated at checkpoints and at the final integration pass. A part that passed
|
|
389
|
+
in-loop and then fails a checkpoint gate is **reopened** — log it as a failed approach with the checkpoint as
|
|
390
|
+
evidence.
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## 7. Extra critic inputs and gates
|
|
395
|
+
|
|
396
|
+
Added to the standard contract in `critic-rubrics.md`. **Which rubric applies depends on the part**: scene
|
|
397
|
+
parts use the scene/level rubric, asset parts use the model/asset rubric. **Which gates apply depends on the
|
|
398
|
+
evidence mode.**
|
|
399
|
+
|
|
400
|
+
### In-loop rounds (Unity snapshot)
|
|
401
|
+
|
|
402
|
+
**Inputs:** the Unity camera snapshot(s), the `UnityStats` metrics, **the bake tier**, and the previous
|
|
403
|
+
round's snapshot and verdict.
|
|
404
|
+
|
|
405
|
+
| Gate | Fails when |
|
|
406
|
+
|---|---|
|
|
407
|
+
| **Camera lock + frozen rig** | evidence not rendered from the `cameras.md` transforms, or the rig changed |
|
|
408
|
+
| **Bake tier honesty** | the journal does not state the tier, or a production score is compared to a preview one |
|
|
409
|
+
| **Snapshot validity** | the PNG is empty or degenerate — no graphics device, not a dark scene |
|
|
410
|
+
| **Component authority** | a protected `TOOLKIT.*` component reimplemented, bypassed or deleted without the replacement-evidence checklist |
|
|
411
|
+
| **Unity budget indicators** | draw calls / triangles / lightmap memory / tri budget past the loop card's Unity-side ceiling |
|
|
412
|
+
| **Engine-legal skinning** *(asset parts)* | any vertex has > 4 influences, or weights do not normalise to 1.0 |
|
|
413
|
+
| **Rig names** *(asset parts)* | bone names no longer match the Unity Avatar/Animator rig |
|
|
414
|
+
| **Transform hygiene** *(asset parts)* | scale, orientation or pivot wrong at import |
|
|
415
|
+
| **GUID survival** *(asset parts)* | an in-place round changed the GUID, or importer settings were reset |
|
|
416
|
+
| **No placeholder maps** *(asset parts)* | flat-colour or procedural-noise stand-ins for maps the target needs |
|
|
417
|
+
|
|
418
|
+
### Checkpoint rounds (export + browser)
|
|
419
|
+
|
|
420
|
+
**Additional inputs:** the exported metadata dump, the browser frame, browser perf and console log — **and
|
|
421
|
+
the Unity snapshot of the same camera from the same round**, so the two are directly comparable.
|
|
422
|
+
|
|
423
|
+
| Gate | Fails when |
|
|
424
|
+
|---|---|
|
|
425
|
+
| **Export boundary** | a metadata key a passed part owns is absent, default, or contradicts what the round claims it set |
|
|
426
|
+
| **Licence tier** | `extras.metadata.license` is not `"professional"` |
|
|
427
|
+
| **Right export shape** | a level export has `properties: false` (a selection was passed), or a container carries scene metadata it should not |
|
|
428
|
+
| **Components present** | `nodes[i].extras.metadata.components` is missing what the asset is supposed to carry |
|
|
429
|
+
| **Perf** | the loop card's browser FPS / draw-call / load-time budget is missed |
|
|
430
|
+
| **Console** | any error in the browser console |
|
|
431
|
+
|
|
432
|
+
**The Unity-vs-export gap.** A checkpoint is the only place this is visible, and it is the whole reason
|
|
433
|
+
checkpoints exist. With both frames of the same camera in hand, the critic must state **which side of the
|
|
434
|
+
boundary the gap is on**:
|
|
435
|
+
|
|
436
|
+
- *Unity frame right, browser frame wrong* → the export path or the material/metadata translation. Do not
|
|
437
|
+
re-light the scene or re-model the asset. Reopen the part with the export as the named gap.
|
|
438
|
+
- *Both wrong the same way* → it is genuinely the art; carry on in-loop.
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## 8. Scope the target to what can actually cross the boundary
|
|
443
|
+
|
|
444
|
+
The 73-key metadata list **is** the export surface for scene-level look. Anything the target image depends on
|
|
445
|
+
that has no key — screen-space reflections, SSGI/SSAO, custom render passes, bespoke volume stacks — does not
|
|
446
|
+
survive, and a critic that keeps raising it will name the same gap forever.
|
|
447
|
+
|
|
448
|
+
During the interview's target-reachability pass, walk the target against that key list and record whatever
|
|
449
|
+
cannot cross in the loop card's **`OUT OF REACH`** slot. Critics are instructed not to raise gaps against it.
|
|
450
|
+
Where an effect can be *approximated* on the BabylonJS side instead (a reflection probe standing in for SSR,
|
|
451
|
+
baked contact shadows for SSAO), record that as the approach rather than as out of reach.
|
|
452
|
+
|
|
453
|
+
> The precise URP/HDRP boundary is worth **measuring on your first real export** rather than assuming. Export
|
|
454
|
+
> one scene with the effects you care about, dump `scenes[0].extras.metadata`, and record what actually
|
|
455
|
+
> landed in `pipeline.md`. Do that before finalizing the rubric for a job that leans on them.
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
## 9. Known failure modes — check these before blaming the art
|
|
460
|
+
|
|
461
|
+
| Symptom | Cause | Fix |
|
|
462
|
+
|---|---|---|
|
|
463
|
+
| Export produced geometry but no terrain / physics / LODs / components | community licence | §0 — install a valid `license.json`; the log line is `Pro Tools Disabled` |
|
|
464
|
+
| Snapshot PNG is empty or 0 bytes | Editor started with `-nographics` — no graphics device | copilot mode / batchmode with graphics; § 1 |
|
|
465
|
+
| Rounds take minutes each | exporting every round instead of snapshotting | § 6.A — export is a checkpoint, not a step |
|
|
466
|
+
| Scores jump around for no reason | preview- and production-tier bakes being compared | record the tier every round |
|
|
467
|
+
| `Lightmapping.lightingSettings is null` | programmatic scene with no LightingSettings asset | § 2, and remember `MarkSceneDirty` |
|
|
468
|
+
| The fix "stopped working" on the second export | `MarkSceneDirty` was missed, so the assignment never persisted | check `m_LightingSettings` in the `.unity` file |
|
|
469
|
+
| `A lightmap bake is in progress.` | `Lightmapping.isRunning` | poll it out before exporting |
|
|
470
|
+
| Exported the wrong scene | fresh session opened the template default | always pass `--scene` |
|
|
471
|
+
| `/index.html` 404s | `--geometryOnly true` skipped the web-project emit | § 6.B |
|
|
472
|
+
| Skybox/fog missing from a level export | a non-null selection made it a container | §10 — `selection == null` for a level |
|
|
473
|
+
| An asset is missing from the level export | it is not in the exported scene, or the wrong scene was exported | check the model root path; pass `--scene` |
|
|
474
|
+
| Exporter settings changed on their own | `BuildProject` calls `SaveSettings()` every run | snapshot and restore what you toggle |
|
|
475
|
+
| A crashed Blender round recorded as success | missing `--python-exit-code 1` | always pass all four canonical flags |
|
|
476
|
+
| `bpy.ops.import_scene.fbx` not found | operator names moved in 5.x | enumerate the operators in *this* build |
|
|
477
|
+
| Every scene reference to a model broke | wrote to a new path, or delete-then-recreate | edit in place; never remove the `.meta` |
|
|
478
|
+
| Model imports at 1/100 scale or on its side | FBX unit mismatch, or a generated asset's orientation | `transform_apply` after fixing scale/rotation |
|
|
479
|
+
| Unity Hub cannot open the project | copilot mode leaves a resident Editor holding the lock | `bt-stop-editor.sh <ProjectPath>` (§4B.3) |
|
|
480
|
+
| `unity command` cannot connect | Safe Mode, or a batch Editor invisible to `status` | `unity pipeline list`; gate on `unity command`, not `unity status` |
|
|
@@ -27,9 +27,10 @@ _gauntlet/
|
|
|
27
27
|
│ │ # authoring-only) — written in round 1, read on resume.
|
|
28
28
|
│ │ # Only exists when supplied assets carry component metadata.
|
|
29
29
|
│ ├── pipeline.md # Pipeline state for the deliverable kind: project paths,
|
|
30
|
-
│ │ # Unity project root, licence tier,
|
|
31
|
-
│ │ #
|
|
32
|
-
│ │ #
|
|
30
|
+
│ │ # Unity project root, licence tier, capture mode, bake tier,
|
|
31
|
+
│ │ # checkpoint cadence + last checkpoint round, dev-server port,
|
|
32
|
+
│ │ # .blend/FBX paths. Written round 1, re-verified on every
|
|
33
|
+
│ │ # resume (a resident Editor does NOT survive a pause).
|
|
33
34
|
│ ├── progress.md # THE resume file — format below.
|
|
34
35
|
│ ├── rounds/
|
|
35
36
|
│ │ ├── round-01.md # Append-only per-round journal: what was built, the critic's
|
|
@@ -48,10 +49,10 @@ _gauntlet/
|
|
|
48
49
|
```markdown
|
|
49
50
|
# Gauntlet Progress
|
|
50
51
|
Name: cod-fps
|
|
51
|
-
Kind: web-game | unity
|
|
52
|
+
Kind: web-game | unity
|
|
52
53
|
Template: gauntlet | bounded
|
|
53
54
|
Round: 12 (total, cumulative across all sessions)
|
|
54
|
-
Budgets: rounds 12/40 · no-improvement streak 0/3 · stall: none · bake tier: preview
|
|
55
|
+
Budgets: rounds 12/40 · no-improvement streak 0/3 · stall: none · bake tier: preview · last checkpoint: round 1
|
|
55
56
|
|
|
56
57
|
## Parts
|
|
57
58
|
- [x] P1 Movement & player controller — passed round 4 (9.0/10, gates all PASS)
|