本文へ移動
cccskills
無料GitHub で公開

threejs

Three.js scene-graph parsing and export workflows: mesh baking, InstancedMesh expansion, part partitioning, per-link OBJ export, and URDF articulation.

インストール方法を見る

含まれるファイル(7)

  • SKILL.md3.2 KB
  • references/joint-type-heuristics.md1.1 KB
  • references/link-export-rules.md680 B
  • references/urdf-minimal.md677 B
  • scripts/build_urdf_from_scene.mjs3.8 KB
  • scripts/export_instanced_obj.mjs1.7 KB
  • scripts/export_link_objs.mjs2.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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.
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:

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

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)

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.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Perform various data analysis on SEC 13-F and obtain some insights of fund activities such as number of holdings, AUM, and change of holdings between two quarters.

日本語の概要は準備中です。原文の説明を表示しています。

benchflow-ai/skillsbench1,8372026年7月24日 更新

AC branch pi-model power flow equations (P/Q and |S|) with transformer tap ratio and phase shift, matching `acopf-math-model.md` and MATPOWER branch fields. Use when computing branch flows in either direction, aggregating bus injections for nodal balance, checking MVA (rateA) limits, computing branch loading %, or debugging sign/units issues in AC power flow.

日本語の概要は準備中です。原文の説明を表示しています。

benchflow-ai/skillsbench1,8372026年7月24日 更新

Redact text from PDF documents for blind review anonymization

日本語の概要は準備中です。原文の説明を表示しています。

benchflow-ai/skillsbench1,8372026年7月24日 更新

Use when checking simplified ADA-derived plan-view bathroom accessibility constraints such as turning space, door clear width, toilet centerline, grab bars, and lavatory knee/toe clearance.

日本語の概要は準備中です。原文の説明を表示しています。

benchflow-ai/skillsbench1,8372026年7月24日 更新

Analyze failed GitHub Action jobs for a pull request.

日本語の概要は準備中です。原文の説明を表示しています。

benchflow-ai/skillsbench1,8372026年7月24日 更新

Use when extracting plan-view architectural geometry from DXF files with semantic CAD layers, especially when outputs must normalize rooms, doors, fixtures, clearances, and grab bars into machine-checkable JSON.

日本語の概要は準備中です。原文の説明を表示しています。

benchflow-ai/skillsbench1,8372026年7月24日 更新

benchflow-ai のスキルをすべて見る

このスキルの問題を報告する