cyfxxx/pi-tools/threejs-scene-setup
Claude Code and agent skill by cyfxxx/pi-tools
- community
- ext:[{"type":"plugin","description":"Custom plugin integration"}]
Checking that the SKILL.md file is still in the repository.
Stand up a three.js scene: import maps and the three/addons path, the Scene/PerspectiveCamera/WebGLRenderer trio, the setAnimationLoop render loop, responsive resize, and OrbitControls. Use when starting or debugging a three.js app — when the user mentions three.js, THREE.Scene, WebGLRenderer, PerspectiveCamera, the render loop, resizing, or OrbitControls. For models use threejs-gltf-loading; for materials/lights use threejs-materials-lighting.
Install
npx vskill@latest install cyfxxx/pi-tools/threejs-scene-setupSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as gamedev-skills/awesome-gamedev-agent-skills/threejs-scene-setup.
three.js Scene Setup
Create the foundation of a three.js app: module loading, the scene/camera/renderer trio, the render loop, responsive resizing, and camera controls. Patterns target r184. Read the installed three version before changing an existing project because examples and addons move across releases.
When to use
- Use when bootstrapping a three.js scene, fixing a blank/black canvas, making the
canvas responsive, setting up the animation loop, or adding OrbitControls.
- Use when
package.jsondepends onthreeand code does `import * as THREE from
'three'`.
When *not* to use: loading .gltf/.glb models or skinned animation → threejs-gltf-loading. Materials, lights, shadows, environment maps → threejs-materials-lighting. 2D rendering → pixijs-rendering.
Core workflow
- Load three.js as an ES module with an import map. Since r147 the bare
specifier 'three' and 'three/addons/' must be mapped (in HTML or by a bundler). Addons (controls, loaders) live under three/addons/....
- Create the trio. A
Scene(root of the graph), a `PerspectiveCamera(fov,
aspect, near, far) moved back from the origin, and a WebGLRenderer whose domElement is in the DOM. Set size and pixelRatio`.
- Add a mesh.
new Mesh(geometry, material)andscene.add(mesh). With a
lit material you also need a light (see threejs-materials-lighting).
- Drive a render loop with `renderer.setAnimationLoop(fn)`. It's the modern,
WebXR-/WebGPU-safe replacement for hand-rolled requestAnimationFrame. Use a Clock for delta time.
- Handle resize so the camera aspect and renderer match the canvas; update
camera.aspect, call updateProjectionMatrix(), and renderer.setSize(...).
- Add `OrbitControls` for orbit/pan/zoom while developing. Confirm something
actually renders (a lit cube, the controls responding) before assuming success.
Patterns
1. HTML import map + module entry (no bundler)
With a bundler (Vite/webpack), skip the import map and just npm i three; the same import statements resolve.
2. Scene + camera + renderer
3. The render loop (setAnimationLoop + Clock)
4. Responsive resize
5. OrbitControls (orbit / pan / zoom)
Pitfalls
- `Failed to resolve module specifier "three"` → missing import map (or bundler
config). Map both "three" and "three/addons/"; addon paths must end with /.
- Black canvas, no errors → camera is at the origin (inside/behind the object),
or you used a lit material (MeshStandardMaterial) with no light. Move the camera back; use MeshNormalMaterial/MeshBasicMaterial to verify geometry first.
- Nothing animates → you never called
renderer.renderinside the loop, or you
call setAnimationLoop but render outside it.
- Stretched / squashed view on resize → you resized the renderer but didn't
update camera.aspect + updateProjectionMatrix().
- Blurry or jagged on HiDPI → set
renderer.setPixelRatio(...); cap it (≈2) so
4K/retina screens don't tank performance.
- OrbitControls feel dead → with
enableDamping = trueyou must call
controls.update() every frame.
- Old tutorials use `<script src="three.min.js">` → since r147 three.js ships
ES modules only; use type="module" + import maps.
References
- For coordinate conventions, the scene-graph (
Group, parent/child transforms,
Object3D add/remove), OrthographicCamera for 2.5D, and disposing of geometries/materials/textures to avoid leaks, read references/scene-graph.md.
Related skills
threejs-materials-lighting— give surfaces a lit look (lights, shadows, PBR).threejs-gltf-loading— load 3D models and play their animations.pixijs-rendering— 2D rendering in the browser.fps-shooter— a 3D genre template that composes three.js skills.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpacks/gamedev/skills/web/threejs-scene-setup/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
pluginCustom plugin integration
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cyfxxx/pi-tools/threejs-scene-setup)