obj-exporter
Utility to convert Three.js geometry into the industry-standard OBJ file format.
Install
mkdir -p .claude/skills/obj-exporter && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6508" && unzip -o skill.zip -d .claude/skills/obj-exporter && rm skill.zipInstalls to .claude/skills/obj-exporter
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Three.js OBJExporter utility for exporting 3D geometry to Wavefront OBJ format. Use when converting Three.js scenes, meshes, or geometries to OBJ files for use in other 3D software like Blender, Maya, or MeshLab.Key capabilities
- →Export Three.js scenes to OBJ format
- →Apply world transforms to geometry
- →Merge multiple meshes into single OBJ
- →Preserve hierarchy via named groups
How it works
The utility uses the Three.js OBJExporter to serialize geometry, supporting world matrix application and mesh merging to ensure compatibility with external 3D software.
Inputs & outputs
When to use obj-exporter
- →Export 3D web models to Blender
- →Convert Three.js meshes to OBJ
- →Prepare 3D assets for Maya
About this skill
OBJExporter Guide
Basic Structure
OBJ is a text-based 3D geometry format:
# Comment
v x y z # Vertex position
vn x y z # Vertex normal
f v1 v2 v3 # Face (triangle)
f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 # Face with texture/normal indices
Example:
# Cube
v 0 0 0
v 1 0 0
v 1 1 0
v 0 1 0
f 1 2 3
f 1 3 4
Three.js OBJExporter
Three.js provides OBJExporter in examples:
import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter.js';
const exporter = new OBJExporter();
const objString = exporter.parse(object3D);
// Write to file (Node.js)
import fs from 'fs';
fs.writeFileSync('output.obj', objString);
Exporting with World Transforms
To export geometry in world coordinates:
// Update world matrices first
root.updateMatrixWorld(true);
// Clone and transform geometry
const worldGeometry = mesh.geometry.clone();
worldGeometry.applyMatrix4(mesh.matrixWorld);
// Create new mesh for export
const exportMesh = new THREE.Mesh(worldGeometry);
const objData = exporter.parse(exportMesh);
Merging Multiple Geometries
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
const geometries = [];
root.traverse((obj) => {
if (obj instanceof THREE.Mesh) {
const geom = obj.geometry.clone();
geom.applyMatrix4(obj.matrixWorld);
geometries.push(geom);
}
});
const merged = mergeGeometries(geometries);
const mergedMesh = new THREE.Mesh(merged);
const objData = exporter.parse(mergedMesh);
Node.js ES Module Setup
For running Three.js in Node.js:
// package.json
{ "type": "module" }
// script.js
import * as THREE from 'three';
import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter.js';
OBJ Export for Scene Components
Component Definition (Hierarchy-Aware)
Treat each named THREE.Group as a component/part. Preserve hierarchy by using the nearest named parent group in the ancestor chain as the owning component for each mesh. Call root.updateMatrixWorld(true) before exporting so matrixWorld is correct.
function collectComponentMeshes(root) {
const componentMap = {};
root.traverse(obj => {
if (obj instanceof THREE.Group && obj.name) {
componentMap[obj.name] = { group: obj, meshes: [] };
}
});
root.traverse(obj => {
if (obj instanceof THREE.Mesh) {
let parent = obj.parent;
while (parent && !(parent instanceof THREE.Group && parent.name)) {
parent = parent.parent;
}
if (parent && componentMap[parent.name]) {
componentMap[parent.name].meshes.push(obj);
}
}
});
return Object.fromEntries(
Object.entries(componentMap).filter(([_, data]) => data.meshes.length > 0)
);
}
Export Individual Meshes (World Transforms)
import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter.js';
const exporter = new OBJExporter();
function exportMesh(mesh, filepath) {
let geom = mesh.geometry.clone();
geom.applyMatrix4(mesh.matrixWorld);
if (geom.index) {
geom = geom.toNonIndexed();
}
if (!geom.attributes.normal) {
geom.computeVertexNormals();
}
const tempMesh = new THREE.Mesh(geom);
tempMesh.name = mesh.name;
const objData = exporter.parse(tempMesh);
fs.writeFileSync(filepath, objData);
}
Export Merged Component Meshes (Optional)
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
function mergeMeshes(meshes) {
const geometries = [];
for (const mesh of meshes) {
let geom = mesh.geometry.clone();
geom.applyMatrix4(mesh.matrixWorld);
if (geom.index) {
geom = geom.toNonIndexed();
}
if (!geom.attributes.normal) {
geom.computeVertexNormals();
}
geometries.push(geom);
}
if (geometries.length === 0) return null;
return new THREE.Mesh(mergeGeometries(geometries, false));
}
Output Paths
Write OBJ files to the paths specified by the task instructions or a provided output root variable. Avoid hardcoding fixed directories in the skill itself.
When not to use it
- →When exporting non-Three.js geometry
Prerequisites
Limitations
- →Requires manual update of world matrices before export
- →Limited to text-based OBJ format
How it compares
It automates the conversion of web-based 3D objects into standard OBJ files, including handling world coordinates and hierarchy, which is otherwise a manual serialization task.
Compared to similar skills
obj-exporter side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| obj-exporter (this skill) | 3 | 6mo | No flags | Intermediate |
| blockbench-plugins | 0 | 3mo | Review | Intermediate |
| zustand | 113 | 2mo | No flags | Intermediate |
| turborepo | 61 | 2mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by benchflow-ai
View all by benchflow-ai →You might also like
blockbench-plugins
code-is-art
Blockbench plugin/extension development for the 3D modeling tool. Use when creating, modifying, or debugging JavaScript plugins for Blockbench including actions, dialogs, panels, menus, toolbars, model manipulation, animation APIs, and custom formats/codecs. Triggers on Blockbench plugin, Blockbench
zustand
lobehub
Zustand state management guide. Use when working with store code (src/store/**), implementing actions, managing state, or creating slices. Triggers on Zustand store development, state management questions, or action implementation.
turborepo
vercel
Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.
vitest
antfu
Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.
typescript-write
metabase
Write TypeScript and JavaScript code following Metabase coding standards and best practices. Use when developing or refactoring TypeScript/JavaScript code.
react
lobehub
React component development guide. Use when working with React components (.tsx files), creating UI, using @lobehub/ui components, implementing routing, or building frontend features. Triggers on React component creation, modification, layout implementation, or navigation tasks.