Command Palette

Search for a command to run...

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

threejs-ops

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

Application/game-scale three.js: ES modules, GLTF pipeline (DRACO/KTX2/meshopt), AnimationMixer, physics (rapier/cannon-es), react-three-fiber, performance at…

0xDarkMatterот 0xDarkMatter★ 86 звёзд на GitHub

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

Three.js — application & game scale

Patterns for building three.js applications and games: module setup, asset pipelines, animation, simulation loops, physics, the React ecosystem, and staying fast (and leak-free) as scene complexity grows.

Scope split with sibling skills — do not duplicate them:

Concern Owner
Creative/generative three.js — sketches, generative art, shader toys, art-piece particles and post genart-ops
three.js inside a Mapbox GL custom layer (CustomLayerInterface, threebox) mapbox-ops
App/game-scale three.js — modules, assets, animation, loops, physics, R3F, scale, and the game-grade render pipeline, procedural materials and worlds (§9) this skill

1. ES-module reality (read this before writing any <script> tag)

three.js is ES-modules only. The legacy patterns are dead and will 404 or silently break on any modern release:

Dead pattern Removed Use instead
examples/js/* non-module loaders (js/loaders/GLTFLoader.js, THREE.OrbitControls globals) r148 three/addons/ module imports
build/three.js + build/three.min.js UMD builds (<script src=…> + global THREE) r160 build/three.module.js via import map or bundler

Versioning: npm publishes 0.<release>.<patch> — [email protected] is r185. Releases land monthly; pin exact versions.

No-bundler setup (import map)

Copy assets/importmap-starter.html — a complete, runnable starter (import map + addons + resize + setAnimationLoop). The core:

<script type="importmap">
{
  "imports": {
    "three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
    "three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/"
  }
}
</script>
<script type="module">
  import * as THREE from 'three';
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
</script>

Gotchas: both entries MUST pin the same version (mixed versions = instanceof failures across module copies); the three/addons/ key needs the trailing slash; import maps must appear before the first type="module" script.

Bundler vs no-bundler

Situation Choice
Real app/game, npm deps, physics WASM, R3F Vite (npm create vite@latest) — default answer
Demo, CodePen, teaching, drop-in page on an existing site Import map — zero build
@dimforge/rapier3d (WASM-bindgen) Needs a bundler; use rapier3d-compat without one (§5)

With a bundler, import { X } from 'three/addons/…' resolves via the package's exports map — same specifier both worlds.

WebGPU (know it exists; default to WebGL)

Since r167 three ships a parallel build: import { WebGPURenderer } from 'three/webgpu' plus the TSL node-shader language from three/tsl (import-map users: point the "three" key at build/three.webgpu.js instead of three.module.js — it re-exports core; never load both). WebGPURenderer falls back to WebGL2 automatically and initializes async (await renderer.init(), or let setAnimationLoop defer for you). Default for app/game work remains WebGLRenderer — reach for WebGPU when you need compute (GPU crowds, particle sims) or TSL materials. Shader-level TSL/GLSL work is genart-ops territory.


2. GLTF asset pipeline

glTF (.glb) is the format. Wire all three decoders once at startup so any optimized asset loads; full setup, optimization CLI recipes (gltf-transform, gltfpack), and CC0 model sources (Quaternius, Kenney, Poly Pizza) in references/asset-pipeline.md.

import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';

const draco = new DRACOLoader().setDecoderPath(
  'https://www.gstatic.com/draco/versioned/decoders/1.5.7/');
const ktx2 = new KTX2Loader()
  .setTranscoderPath('https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/libs/basis/')
  .detectSupport(renderer);              // MUST pass the live renderer

const loader = new GLTFLoader()
  .setDRACOLoader(draco).setKTX2Loader(ktx2).setMeshoptDecoder(MeshoptDecoder);

const { scene: model, animations } = await loader.loadAsync('hero.glb');

Cloning a skinned character for multiple instances needs SkeletonUtils.clone() — a plain .clone() shares (and corrupts) the skeleton.


3. Animation system

AnimationMixer drives everything (skeletal + morph targets). One mixer per model root; mixer.update(dt) every frame. Crossfades, blending weights, one-shot clips, additive layers, and morph-target patterns in references/animation.md.

const mixer = ne
Полный SKILL.md на GitHub

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

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

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

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

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

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

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

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

assets/importmap-starter.htmlassets/three-facts.jsonreferences/actors-and-steering.mdreferences/animation.mdreferences/asset-pipeline.mdreferences/character-locomotion.mdreferences/game-architecture.mdreferences/game-loop.mdreferences/physics.mdreferences/procedural-materials.mdreferences/procedural-world.mdreferences/r3f-drei.mdreferences/render-pipeline.mdreferences/scale-and-disposal.mdreferences/stylised-rendering.mdreferences/terrain-and-foliage.mdreferences/verification-harness.mdscripts/check-three-facts.py

FAQ

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

Application/game-scale three.js: ES modules, GLTF pipeline (DRACO/KTX2/meshopt), AnimationMixer, physics (rapier/cannon-es), react-three-fiber, performance at scale (InstancedMesh, LOD, draw calls), and high-fidelity games built entirely from code: HDR post stack, PCSS shadows, volumetric fog, GPU-baked procedural PBR materials, procedural worlds and audio. Triggers on: three.js, GLTFLoader, r3f, game loop, WebGL memory leak, boids, browser FPS, AAA look, procedural textures, no-asset game, stylised rendering, NPR, painterly, third-person character, foot IK, terrain, foliage, headless game testing.

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

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

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

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

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

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