threejs · benchflow-ai — Claude Code skill for scene export
This skill maps Three.js scene groups to parts, then prepares per-part OBJ files or URDF links. Use it when a scene needs structured geometry export.
Apache-2.0 8 installs ★ 1,933 updated 2026-10-24
npx skills add benchflow-ai/skillsbench --skill threejs -a claude-codeWhat threejs does
The skill treats named THREE.Group nodes as parts and assigns each mesh to its nearest named group ancestor. Nested named groups remain separate, while empty parts are skipped. Sorting part names keeps the output order consistent.
Before export, update world matrices and apply each mesh’s transform to its geometry. The workflow also handles InstancedMesh instance matrices and can convert Y-up geometry to Z-up. Meshes for a part are merged into its own OBJ; named groups can also map to URDF links. Joint types default to fixed, so moving joints need evidence in the scene to be classified as revolute or prismatic.
The package includes Node.js scripts for instanced OBJ export, per-link OBJ export, and URDF generation. For example, the per-link exporter accepts a scene and output directory through node scripts/export_link_objs.mjs --input <scene_js> --out-dir <dir>. Adjust input and output paths in the scripts when your files use different locations.
What it helps with
- Split a scene into parts using named groups
- Bake world transforms into mesh geometry before export
- Expand
InstancedMeshinstances for OBJ output - Write a separate OBJ file for each part
- Build URDF links and joints from scene groups
Example prompts for the agent
- Split this Three.js scene by named groups and export one OBJ for each part.
- Export the
InstancedMeshinstances to OBJ with their transforms applied. - Build a URDF from the named groups in this scene and place the mesh files in the output directory.
How to install threejs
1Skills CLI (Vercel)
npx skills add benchflow-ai/skillsbench --skill threejs -a claude-code2Manually: put the files in place
~/.claude/skills/threejs/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/threejs/
1Skills CLI (Vercel)
npx skills add benchflow-ai/skillsbench --skill threejs -a codex2Manually: put the files in place
.agents/skills/threejs/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add benchflow-ai/skillsbench --skill threejs -a cursor2Manually: put the files in place
.cursor/skills/threejs/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install benchflow-ai/skillsbench tasks/threejs-structure-parser/environment/skills/threejs2Manually: put the files in place
.github/skills/threejs/SKILL.md1Skills CLI (Vercel)
npx skills add benchflow-ai/skillsbench --skill threejs -a gemini-cli2Platform CLI
gemini skills install https://github.com/benchflow-ai/skillsbench --path tasks/threejs-structure-parser/environment/skills/threejsManually: put the files in place
.devin/skills/threejs/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add benchflow-ai/skillsbench --skill threejs -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about threejs
How do I install threejs in Claude Code?
Run npx skills add benchflow-ai/skillsbench --skill threejs -a claude-code. The skill file is located at ~/.claude/skills/threejs/SKILL.md.
What does the threejs skill do?
It defines how to map scene meshes to named groups and export each part as OBJ. It also describes mapping groups to URDF links and joints.
How does threejs handle nested named groups?
Each named nested group is a separate part. A mesh belongs to its nearest named group ancestor, rather than being merged into a parent part.
Source text
SKILL.md · Apache-2.0
---
name: threejs
description: "Three.js scene-graph parsing and export workflows: mesh baking, InstancedMesh expansion, part partitioning, per-link OBJ export, and URDF articulation."
---
# Three.js Scene Graph + Export
## Quick start
1) Load the module, call `createScene()`, then `updateMatrixWorld(true)`.
2) Treat **named `THREE.Group` nodes as parts/links**.
3) Assign each mesh to its **nearest named ancestor**.
4) Bake world transforms into geometry before export.
5) Export per-part OBJ (and optionally URDF) using deterministic ordering.
## Scene graph essentials
```
Object3D (root)
├── Group (part)
│ ├── Mesh
│ └── Group (child part)
│ └── Mesh
└── Group (another part)
└── Mesh
```
- `THREE.Scene` / `THREE.Object3D`: containers
- `THREE.Group`: logical part (no geometry)
- `THREE.Mesh`: geometry + material
## Part partitioning rules
- Parts are **named groups** at any depth.
- Each mesh belongs to the **nearest named ancestor**.
- Nested named groups are separate parts; **do not merge** their meshes into parents.
- Skip empty parts; sort part names for determinism.
```javascript
function buildPartMap(root) {
const parts = new Map();
root.traverse((obj) => {
if (obj.isGroup && obj.name) parts.set(obj.name, { group: obj, meshes: [] });
});
root.traverse((obj) => {
if (!obj.isMesh) return;
let parent = obj.parent;
while (parent && !(parent.isGroup && parent.name)) parent = parent.parent;
if (parent && parts.has(parent.name)) parts.get(parent.name).meshes.push(obj);
});
return Array.from(parts.values()).filter((p) => p.meshes.length > 0);
}
```
## Mesh baking (world transforms)
Always bake transforms before export:
```javascript
root.updateMatrixWorld(true);
let geom = mesh.geometry.clone();
geom.applyMatrix4(mesh.matrixWorld);
if (geom.index) geom = geom.toNonIndexed();
if (!geom.attributes.normal) geom.computeVertexNormals();
```
### InstancedMesh expansion
```javascript
const tempMatrix = new THREE.Matrix4();
const instanceMatrix = new THREE.Matrix4();
obj.getMatrixAt(i, instanceMatrix);
tempMatrix.copy(obj.matrixWorld).multiply(instanceMatrix);
```
### Axis conversion (Y-up to Z-up)
```javascript
const axisMatrix = new THREE.Matrix4().makeRotationX(-Math.PI / 2);
geom.applyMatrix4(axisMatrix);
```
## Per-part OBJ export
- Collect meshes owned by each part.
- **Do not traverse into child named groups** when exporting a part.
- Merge baked geometries per part and write `<part>.obj`.
Reference: `references/link-export-rules.md`.
## Relation between Three.js and URDF articulation
- Use named groups as links.
- Parent is the nearest named ancestor link.
- Joint type defaults to `fixed` unless evidence suggests `revolute`/`prismatic`.
- Sort link and joint names for determinism.
References:
- `references/joint-type-heuristics.md`
- `references/urdf-minimal.md`
## Scripts
- InstancedMesh OBJ exporter: `node scripts/export_instanced_obj.mjs`
- Per-link OBJ exporter: `node scripts/export_link_objs.mjs --input <scene_js> --out-dir <dir>`
- URDF builder: `node scripts/build_urdf_from_scene.mjs --input <scene_js> --output <file.urdf> --mesh-dir <mesh_dir>`
Adjust inputs/outputs inside scripts as needed.
© benchflow-ai · Apache-2.0 · benchflow-ai/skillsbench
Similar skills
All skills for Game dev and 3D: Unity, Unreal, Godot, Blender →threejs by other authors comes first.