Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

threejs-builder

БесплатноЗапускает вложенные скриптыНе проверен

Design and implement lightweight Three.js (r150+) ES-module scenes—hero sections, interactive product viewers, particle backdrops, GLTF showcases, or quick…

chongdashuот chongdashu★ 35 звёзд на GitHub15 установок в других каталогах

Об этом скилле

Three.js Builder

A Codex-ready framework for shipping elegant, performant Three.js web experiences with modern ES modules.

Reference Files

Read the appropriate reference when working on specific topics:

Topic File Use When
GLTF Models references/gltf-loading-guide.md Loading, caching, cloning 3D models, SkeletonUtils
Reference Frames references/reference-frame-contract.md Calibration, anchoring, axis correctness, debugging
Game Development references/game-patterns.md State machines, animation switching, parallax, pooling
Advanced Topics references/advanced-topics.md Post-processing, shaders, physics, instancing
Calibration Helpers scripts/README.md GLTF calibration helper installation and usage

Philosophy: Start from Scene Intent

Three.js work lives inside a scene graph: parents transform children, and everything in scene is rendered.

Before writing code, ask:

  • What is the core visual element or metaphor (hero object, particle field, data glyph)?
  • How should visitors manipulate or perceive it (static hero, orbit control, camera-relative movement)?
  • What level of hardware/performance do we target (mobile hero snippet vs. desktop interactive)?
  • Which animation best communicates the story (continuous rotation, bobbing, interaction-driven)?

Core principles:

  1. Scene graph first – model hierarchy and transforms before materials.
  2. Intent-driven primitives – boxes, spheres, torus, planes cover 80% of hero cases; reach for GLTF only when fidelity demands it.
  3. Animation as transformation – treat animation as evolving position/rotation/scale with renderer.setAnimationLoop.
  4. Performance through restraint – reuse geometries/materials, clamp device pixel ratio, keep draw calls low.

Foundational Principle: Lock a “Reference Frame Contract” First

Most Three.js bugs are not “rendering bugs” — they’re reference-frame bugs: wrong origin, wrong up-axis assumption, wrong forward direction, wrong “ground = y=0” semantics, wrong color space, or wrong loading environment.

Treat your scene like a contract you must prove once, then never violate:

  • Axes: which way is forward for gameplay, and how do models map to it?
  • Anchors: what does “on the ground” mean for each asset class?
  • Units: what is 1 unit (meter-ish? pixel-ish?) and how do imported assets fit?
  • Color: are textures and output color space correct?

If you don’t lock this contract early, you will chase symptoms: inverted movement, floating/sinking models, “wrongly loaded” textures, and end-state hangs caused by tangled state transitions.

The Calibration Pass (do this before building gameplay)

Do a 60-second calibration scene and lock constants (axes/anchors/scale/color) before shipping gameplay systems.

Deep guide + troubleshooting map: references/reference-frame-contract.md

Mesh Forward Verification (Do Not Guess)

Don’t “eyeball rotate until it looks right” and don’t assume “GLTF faces -Z”.

In the calibration scene, prove each imported model’s forward direction and lock it as a constant (global MODEL_YAW_OFFSET or per-asset yawOffset).

If you want a reusable helper module instead of hand-rolling arrows/box helpers each time:

  • Install (repo-scoped): run python3 .codex/skills/threejs-builder/scripts/install-gltf-calibration-helpers.py --out ./gltf-calibration-helpers.mjs
  • Install (from within the skill folder): run python3 scripts/install-gltf-calibration-helpers.py --out ./gltf-calibration-helpers.mjs
  • Use: import and call attachGltfCalibrationHelpers(...) (see scripts/README.md)

Minimal check:

// In Three.js, an Object3D’s "forward" is its local -Z axis.
const localForward = new THREE.Vector3(0, 0, -1);

// Attach a visible arrow to the model so you can *see* its forward.
const forwardArrow = new THREE.ArrowHelper(localForward, new THREE.Vector3(0, 1.2, 0), 1.2, 0xff00ff);
modelRoot.add(forwardArrow);

// Also log the current world-forward for debugging (post-normalization and post-rotation).
const worldForward = new THREE.Vector3();
modelRoot.getWorldDirection(worldForward);
console.log('model world forward (-Z):', worldForward.toArray());

Then decide:

  • If the mesh runs backward, set yawOffset = Math.PI.
  • If it faces the camera (common symptom), your yaw convention is wrong—flip the offset and re-check.

Coordinate System & Camera Awareness (Critical)

Three.js is right-handed: +X right, +Y up, +Z toward the camera. Many GLTF assets are authored facing -Z, but verify per pack (don’t assume). Camera-relative controls must project the camera forward vector onto the XZ plane, normalize, then derive the right vector via a right-handed cross product to avoid inverted WASD when the camera orbits.

const forward = new THREE.Vector3();
camera.getWorldDirection(forward);
forward.y = 0;
forward.normalize();
// Righ
Полный SKILL.md на GitHub

Установить threejs-builder в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/advanced-topics.mdreferences/game-patterns.mdreferences/gltf-loading-guide.mdreferences/reference-frame-contract.mdscripts/README.mdscripts/gltf-calibration-helpers.mjsscripts/install-gltf-calibration-helpers.py

FAQ

Что делает скилл threejs-builder?

Design and implement lightweight Three.js (r150+) ES-module scenes—hero sections, interactive product viewers, particle backdrops, GLTF showcases, or quick prototypes—whenever prompts mention 'three.js/threejs scene', '3D web background', 'orbit controls', or 'WebGL demo'.

Как установить скилл threejs-builder?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл threejs-builder запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить threejs-builder с