threejs
БесплатноБез исполняемых скриптовНе проверенThree.js is a JavaScript library for building interactive 3D graphics in the browser with WebGL and WebGPU. Use it for 3D product configurators, data…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Three.js
Overview
Three.js is a JavaScript library for creating interactive 3D graphics in the browser. It provides a scene graph, PBR materials, lighting, model loaders (glTF, FBX), and performance tools such as instanced rendering. React Three Fiber (R3F) is a declarative React renderer for it, with Suspense-based loading and automatic disposal.
Versions checked: three 0.186 (r186), @react-three/fiber 9.8, @react-three/drei 10.7. Things that differ from older tutorials:
- Install from npm and import addons from
three/addons/...(for examplethree/addons/controls/OrbitControls.js); the oldthree/examples/jsm/...paths andoutputEncoding/Texture.encoding(removed in r152, nowoutputColorSpace/colorSpace) are legacy. THREE.Clockis deprecated since r182; useTHREE.Timer(timer.update()thentimer.getDelta()).WebGPURendererand node materials come fromthree/webgpu, shaders written in TSL fromthree/tsl. WebGPU renderer async methods (renderAsync,computeAsync) are deprecated since r180.DRACOLoader.setDecoderConfig()is deprecated (r185); Draco will always use WASM.@react-three/fiber9 pairs with React 19; v8 pairs with React 18.@react-three/drei10 needs R3F 9.
Instructions
- When setting up a scene, create a
Scene,PerspectiveCamera(orOrthographicCamera) andWebGLRenderer, addOrbitControls, and setrenderer.setPixelRatio(Math.min(devicePixelRatio, 2)). The renderer's default tone mapping is none; settoneMapping = THREE.ACESFilmicToneMappingyourself in vanilla code (R3F's<Canvas>already uses ACES Filmic and sRGB output unlessflatis set). - When creating objects, combine geometries (box, sphere, plane, custom
BufferGeometry) with materials (MeshStandardMaterialfor PBR,MeshPhysicalMaterialfor clearcoat, transmission) and setcolorSpace = THREE.SRGBColorSpaceon colour textures only (not normal, roughness or metalness maps). - When loading models, use
GLTFLoaderfor glTF/GLB. For compressed files addDRACOLoader(copy the decoder fromnode_modules/three/examples/jsm/libs/draco/gltf/to your public folder and callsetDecoderPath) andKTX2Loader(transcoder inexamples/jsm/libs/basis/, callsetTranscoderPathanddetectSupport(renderer)). Compress withgltf-transformorgltfpackfirst. - When building lighting, combine ambient, directional, point and spot lights with an HDR environment map (
RGBELoaderplusPMREMGenerator, or drei<Environment>); enablerenderer.shadowMap.enabledandcastShadow/receiveShadowonly where needed. - When animating, drive everything from
renderer.setAnimationLoop(fn)and use the timer delta, not a fixed step. - When optimizing, use
InstancedMeshfor 100+ identical objects, merge static geometry, use LOD, and calldispose()on geometries, materials and textures you remove. - In React, use R3F with drei helpers (
OrbitControls,Environment,useGLTF,ContactShadows) and@react-three/postprocessingfor bloom or SSAO.useGLTFenables Draco (decoder fetched from Google's CDN) and Meshopt by default; calluseGLTF.preload(url)anduseGLTF.setDecoderPath(...)to self-host the decoder.
Minimal vanilla scene
npm install three
import * as THREE from 'three'
import { OrbitControls } from 'three/addons/controls/OrbitControls.js'
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'
import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'
const renderer = new THREE.WebGLRenderer({ antialias: true })
renderer.setSize(innerWidth, innerHeight)
renderer.setPixelRatio(Math.min(devicePixelRatio, 2))
renderer.toneMapping = THREE.ACESFilmicToneMapping
document.body.appendChild(renderer.domElement)
const scene = new THREE.Scene()
const camera = new THREE.PerspectiveCamera(45, innerWidth / innerHeight, 0.1, 100)
camera.position.set(2, 1.5, 3)
const controls = new OrbitControls(camera, renderer.domElement)
scene.add(new THREE.HemisphereLight(0xffffff, 0x444455, 1.2))
const draco = new DRACOLoader().setDecoderPath('/draco/')
const loader = new GLTFLoader().setDRACOLoader(draco)
loader.load('/models/sneaker.glb', (gltf) => scene.add(gltf.scene))
const timer = new THREE.Timer()
renderer.setAnimationLoop(() => {
timer.update()
scene.rotation.y += timer.getDelta() * 0.3
controls.update()
renderer.render(scene, camera)
})
Examples
Example 1: Build a 3D product configurator
User request: "Create a 3D product viewer where users can change colors and rotate the model"
npm install three @react-three/fiber @react-three/drei # React 19 project
import { Canvas } from '@react-three/fiber'
import { OrbitControls, Environment, ContactShadows, useGLTF } from '@react-three/drei'
import { useState } from 'react'
function Sneaker({ color }: { color: string }) {
const { scene, materials } = useGLTF('/models/sneaker.glb') as any
materials.body.color.set(color)
Установить threejs в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл threejs?
Three.js is a JavaScript library for building interactive 3D graphics in the browser with WebGL and WebGPU. Use it for 3D product configurators, data visualizations, games and creative sites: scenes, cameras, lighting, glTF model loading, performance tuning, and React Three Fiber. Trigger words: threejs, three.js, 3d, webgl, webgpu, react three fiber, r3f, glb, gltf.
Как установить скилл threejs?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл threejs запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic