Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add benchflow-ai/skillsbench --skill threejs -a claude-code
Open on GitHub

What 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 InstancedMesh instances 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 InstancedMesh instances 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-code

2Manually: put the files in place

~/.claude/skills/threejs/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/threejs/

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.

threejs nexu-io Guides the agent in building browser 3D scenes, materials, interactive controls, and post-processing with Three.js. CX Codex +1 3,600installs threejs MengTo Guides your agent through building and debugging interactive Three.js scenes: scene, camera, lights, glTF loading, controls and performance. CX Codex +1 2,500installs threejs mrgoonie A coding-agent skill that walks you through Three.js scenes, shaders and VR work. Useful when a project needs WebGL or WebGPU and you want the agent to know the API. CX Codex +1 1,300installs threejs secondsky A skill with reference files and working examples for Three.js: scenes, materials, lighting, shaders, GLTF loading. Useful when you build 3D in the browser. CX Codex +1 501installs threejs oakoss This skill guides agents through Three.js scenes, WebGPU rendering, TSL shaders, and React Three Fiber. Use it when building 3D features for React or Next.js. CX Codex +1 167installs threejs-perf OpusGameLabs threejs-perf converts repeated Three.js meshes to InstancedMesh instances and batches matrix updates. Cuts draw calls in scenes with hundreds of shared geometries. CX Codex +1 753installs geometry-instanced-mesh zebbern geometry-instanced-mesh guides AI agents to use THREE.InstancedMesh instead of separate meshes for repeating 3D objects. CX Codex +1 ★ 4,719repo stars threejs-fundamentals CloudAI-X threejs-fundamentals sets up Three.js r186 scenes, cameras, renderers, and animation loops for WebGL or WebGPU with TSL. CX Codex +1 24,100installs threejs-shaders CloudAI-X threejs-shaders guides the agent through writing GLSL shaders, custom materials, and TSL nodes for Three.js r186 across WebGL and WebGPU. CX Codex +1 22,000installs threejs-gltf-loading gamedev-skills threejs-gltf-loading — a Claude Code skill for loading glTF and GLB 3D models into three.js r187 and playing animations. The agent uses this skill when importing assets or fixing invisible meshes. CX Codex +1 11,200installs threejs-scene-setup gamedev-skills threejs-scene-setup — a skill for Claude Code sets up a basic three.js r187 scene, camera, renderer, and animation loop. Runs on import errors, blank canvases, or static frames. CX Codex +1 11,100installs

From the same set22

The whole set →
search-driving-distance search-driving-distance gives driving or taxi time, distance and a rough price between two cities, using the distance matrix CSV that comes with the skill. CX Codex +1 31installs glm-basics The glm-basics skill explains how to run the General Lake Model, read its input files, and adjust configuration values. Use it when setting up a lake temperature simulation. CX Codex +1 14installs pymatgen pymatgen handles crystal structure transformations, file conversions between CIF and POSCAR, symmetry analysis, and Materials Project queries. CX Codex +1 12installs trend-analysis trend-analysis guides agents in evaluating time series trends using linear regression and Sen's slope. CX Codex +1 8installs reflow-machine-maintenance-guidance reflow-machine-maintenance-guidance handles reflow oven upkeep questions by computing ramp rates, time above liquidus and conveyor limits from thermocouple logs, MES data and the handbook. CX Codex +1 5installs text-to-speech The text-to-speech skill guides TTS cleanup, loudness matching, and segment timing for video audio exports. CX Codex +1 4installs civ6lib civ6lib validates Civilization 6 district placement and computes adjacency bonuses. Use it when an agent needs to reason about city layouts and game rules. CX Codex +1 2installs meteorology-driver-classification meteorology-driver-classification sorts the columns of an environmental dataset into heat, flow, wind and human drivers, so an attribution run can treat each group as one factor. CX Codex +1 2installs

Project sponsors

Companies that keep this analytics open