Repository navigation
Recipes
Each recipe is a short sequence of tw commands. Outputs are on Commands; this page shows the order and what to read.
The skills follow the verification ladder (tw kb show verification-ladder): the cheapest evidence first.
tw lint site/
tw check site/
tw shot site/ --out shot.png-
lintcatches stale APIs before anything runs. On the starter it printed:
three r186 (pinned URL) · 1 file(s)
0 error(s), 0 warning(s)
-
checkmust end inresult: OK. Readpixels:too:46% differ from the backgroundmeans something covers about half the canvas; 0% with "one flat colour" means nothing rendered. - Look at one shot (700 image tokens at 960 x 540). A
result: OKpage can still look wrong.
tw lint old/Each finding names the release that changed the API and the fix (output on Commands). Fix the errors first: they are APIs that no longer exist in r186 (examples/js, THREE.OrbitControls). Then read the legacy map:
tw kb show current-vs-legacyThe kb recipe upgrade-an-old-project walks the whole port (tw kb show upgrade-an-old-project); it was run when 0.2.0 was made.
tw glb forest.glbRead the draw calls count and the warnings. The forest model on Commands draws 150 times for 150 copies of one mesh, and glb names three ways to instance them: gltf-transform instance, gltfpack -mi, or Blender's glTF export with GPU instances. After instancing, the same trees are one draw call (forest-instanced.glb). Running gltf-transform instance on the test model was not tested for this page.
For a blended double-sided material, glb suggests alphaMode MASK (alphaTest, or alphaToCoverage with MSAA) when the material is a leaf, grass, fence or hair card. The why is in tw kb show transparency-and-blending --section Essentials.
With the polywright plugin installed, threewright-assets gets models from polywright's asset folder with its web-threejs target instead (The skills).
tw check site/ --save before.json
tw check site/ --against before.jsonMake the change between the two runs. The second run lists what changed: renderer and scene counts, object types, new or gone problems and the changed frame region, or no changes.
tw video site/ --out turn.mp4 --seconds 1 --fps 10wrote <work>\turn.mp4 · 10 frames at 10 fps (1s) · 32 KB · driver virtual clock · took <s>
The virtual clock steps the page frame by frame, so the video has exactly seconds x fps frames whatever the machine's speed. For a seamless product loop start from the video-turntable template, whose window.__tw.renderFrame(i, fps) drives each frame.
tw shaders bad-shader/The failing program's error lines come with source context, with > on the line the compiler named (output on Commands).
tw vendor site/ --dry-runThe dry run lists the files and size it would copy; run it again without --dry-run, then tw check site/ --cdn offline to prove the page needs no network.
Using it
- Getting started
- The skills
- Commands
- The knowledge base
- Templates
- Errors and edge cases
- Recipes
- Works with
- FAQ
The releases
Contributing
Elsewhere