/ghibli-threejs:threejs-blender-glb-pipelinefrom ghibli-threejs
Builds a reference-image-driven asset pipeline from headless Blender to GLB for a three.js scene. Handles asset contracts, procedural generators, preview renders, Draco compression, and quality scoring.
Ships in ghibli-threejs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turn a reference image into an explorable three.js scene built from procedural Blender
generators. Stack: Blender 5.x run as {{blender path}} --background --factory-startup --python craft_<slug>.py, glTF 2.0 binary export, three.js GLTFLoader (+ DRACOLoader),
vanilla or R3F. The generators are deterministic Python (seeded), so every asset can be
rebuilt, reviewed and iterated by agents.
{{object}} in Blender", "make GLBs for …".Turn
{{reference image}}into an explorable 3D scene with orbit camera controls and preset views. Use my headless Blender ({{blender path}}) to produce one GLB per object.
- Asset contract first: write
blender/CONTRACT.mdcovering metres, Z-up, the viewer-facing side on −Y, the grounding rule, required mesh/material names the web code will look up (e.g.Leaves*for wind,{{Shirt}}for breathing), budgets, and an acceptance loop (render a preview, compare with the reference, iterate ≥ 3 times, check a rear view). Give each asset its attachment numbers: rope anchor points, the Z of the surface a figure rests on, a chest pivot.- Parallelise: one subagent per asset group (tree / figure / architecture / props / instancing assets). Each writes
craft_<slug>.py+ GLB + preview + entry JSON; merge the manifest yourself. Review every preview against the reference and send weak ones back.- Textures from the reference: perspective-crop painted surfaces (a canvas, a sketchbook) straight out of the image with PIL
Image.QUADand map them onto the model.- Web scene: a single HTML file, three.js via import map. Place every GLB from its measured bounding box, never hard-coded offsets. Derive dependent placements from the reported numbers (e.g. tree yaw from the rope anchor, so the swing lands under the limb). A terrain height function shared by JS scatter and shaders. OrbitControls with damping, preset view buttons with numeric hotkeys, a loading bar.
- Instance at scale: grass and flowers as
InstancedMesh; reuse GLB sub-meshes as instanced geometry viamesh.matrixWorld × instanceMatrix.- Verify in a real browser each round: reference view, eye level, close-up, max zoom-out. Read the console. Profile triangles per mesh when it's slow.
Per-asset agent prompt (e.g. one tree species per agent):
Build ONE Blender
{{asset}}from this reference followingblender/CONTRACT.md: metres, Z up, ground Z = 0, base on the origin, viewer side −Y. Material names exactly{{Bark / Moss / Leaves light / Leaves dark (/ Blossom)}}. Budget{{N}}triangles and{{M}}MB because it is instanced{{20–40}}×. Iterate ≥ 3 times comparing the preview PNG with the reference; report theEXPORTEDline and the REQUIRED numbers.
Then review each preview yourself and send back specific fixes — every first pass of the trees came back too sparse.
references/CONTRACT.template.md. It fixes units, axes, naming, budgets,
acceptance and the report format, so parallel agents produce interchangeable assets.references/studio.py is a small helper library: mat() (painterly materials with
optional sRGB-correct grain), Builder (accumulate geometry per material → one mesh per
material, so draw calls stay low), primitives (box, tube, lathe, sphere,
extrude), and export() which grounds at Z = 0, writes .glb, .blend, a transparent
Cycles preview .png and <slug>.entry.json, and prints
EXPORTED slug: X × Y × Z m, N triangles, S MB. Generators never write the shared
manifest, so they run in parallel; merge_manifest() folds entries in by id.ROPE_TOP = 2.75) so a rebuild can't drift from what the scene expects.const bbox = o => { o.updateMatrixWorld(true); return new THREE.Box3().setFromObject(o) }
function sitOn(obj, x, z, y = terrainHeight(x, z), yaw = 0){
obj.rotation.y = yaw; obj.position.set(0, 0, 0)
const b = bbox(obj); obj.position.set(x, y - b.min.y, z); scene.add(obj); return obj }
Find parts by the contract's names (/leaves/i.test(mesh.name + ' ' + mat.name)), never by
index. For instancing, bake each node transform into the geometry
(geo.clone().applyMatrix4(o.matrixWorld)), one InstancedMesh per mesh.
.35·ellipsoid + .15·crown − .5·Z). Faceted normals read as
green boxes; smooth outward normals read as balloons..7·billow ellipsoid + .3·crown dome, 80 % over the
card's own) and each card is wound to agree with them — otherwise three.js DoubleSide
flips half the sunlit cards dark. Set them with normals_split_custom_set_from_vertices;
the glTF exporter keeps them.u −= 2(u·o)o, p ≈ .55–.75) onto the billow's outward side.export() saved the GLB, then re-render. The GLB stays texture-free.Generators write plain GLBs; one script compresses them in place and is run after every Blender export:
CLI="npx --yes @gltf-transform/[email protected]" # a pinned version
$CLI webp in.glb tmp.glb --lossless true --effort 100 # only if the GLB embeds images
$CLI draco tmp.glb out.glb --quantize-color 12
Web side: loader.setDRACOLoader(new DRACOLoader().setDecoderPath('<three CDN>/examples/jsm/libs/draco/gltf/')),
and call draco.preload() so the decoder downloads alongside the models.
--quantize-color 12: Draco's default 8 bits bands dark vertex colours.position (vLocal): meshopt
quantises into a normalised range wrapped in a node transform, so every vLocal-driven
pattern changes scale. Draco decodes back to floats in model space.KHR_draco_mesh_compression. Under set -o pipefail, detecting that with … | grep -q
reports false (grep closes the pipe early and the writer dies of SIGPIPE).optimize --compress draco --texture-compress webp --texture-size 1024 --simplify false --join false --instance false instead.bufferViews, or a glTF library without a Draco decoder registered, fails on them.
Run every parse-the-GLB check below on the plain export, before compressing. Blender's
own importer reads Draco + WebP GLBs.?v=…) when topology/UVs change so browsers drop stale copies.Rate every object in the scene from six perspectives (silhouette, form, material, life, integration, performance), weighted 20/20/20/10/20/10. Rank them in a master issue with a checklist. Then take them one at a time from the lowest score: enhance, verify in the live scene, re-score, tick, and comment what changed.
export_vertex_color='MATERIAL' gives VEC3.
Use export_vertex_color='ACTIVE' and confirm the accessor is VEC4 by parsing the GLB JSON.
In three.js rename non-colour data attributes (e.g. fin weights) so they don't tint.(u, 1 − v).
Verify by parsing the GLB, not by eye.part.quaternion.copy(rest); part.rotateX(th).primitive_ico_sphere_add(subdivisions=1) is a bare 20-face icosahedron (faceted
haunches); moss at detail 1 reads as flat leaves — use 2. Clamp moss domes at Z ≥ 0 or
grounding lifts the whole model.me.materials.clear() after setting per-face material indices resets every face to slot 0.
Add slots first, then set indices.material.copy() (share the baked texture), seam hidden under something, new parts on
their own seed so existing geometry stays vertex-identical.computeVertexNormals() on non-indexed geometry gives flat facets — keep lathe normals.sphere(jitter=…) that draws from the module's global
rng once per vertex makes the whole layout order-dependent: adding a jittered primitive,
or changing an existing one's detail (vertex count), reshuffles every later draw and
moves trees, shrubs and roots you never touched. Give every new feature its own
random.Random(seed) (or an @own_rng decorator that swaps the global for the call), never
change the detail of a jittered primitive, and diff the exported placement JSON (plants,
spots) after every run — it must be byte-identical unless you meant to move something..blend.clip_start at a chosen depth renders a cross-section — a quick check
that folded parts sit against the body.references/CONTRACT.template.md — asset contract to copy into blender/CONTRACT.md.references/studio.py — Blender helper library (materials, Builder, primitives, export, manifest merge).references/generator-template.py — skeleton for one craft_<slug>.py.threejs-procedural-vegetation · threejs-open-world-streaming · threejs-shell-fur-rendering · threejs-stylized-rock-material · threejs-fish-school-boids · threejs-webgl-performance-profiling · threejs-headless-visual-verification · threejs-floating-island-landmark · threejs-first-person-bvh-walk
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
31 skills in this plugin
/threejs-boat-buoyancy-steeringFloats a boat (or any buoyant prop) on three.js water with Gerstner waves generated from one JS table that feeds both the GLSL vertex shader and a CPU waveHeight(), four-probe heave/pitch/roll damped springs, an arc-length drift lane that bends round rocks, click-to-steer W/A/S/D rowing with momentum and drag, an autopilot that pursues the lane back, and a chase camera that keeps the orbit. Use when the user wants a drifting or steerable boat, buoyancy, objects bobbing on waves, Gerstner waves on a river/lake, a boat autopilot, or a follow/chase camera behind a vehicle on water./threejs-camera-guided-tourBuilds a hands-free guided camera tour for a three.js scene — keyframes as data, a time-parametrised Catmull-Rom (Hermite) path with continuous velocity, one camera-owner flag, the tour driving time of day and a day→night blend, staged creatures crossing the frame, handwritten captions, portrait-phone lens widening, instant hand-back on drag/scroll/tap/Esc, and a seek() hook for screenshots and video capture. Use when adding a tour mode, cinematic flythrough, attract mode, camera path animation, keyframed camera, spline camera or showcase video capture to a WebGL scene.npx claudepluginhub nicksonthc/ghibli-threejs --plugin ghibli-threejs