threejs

Builds and debugs interactive WebGL 3D scenes with Three.js.

Updated May 5, 2026
One-click install
npx skills add https://github.com/josippapez/ai-setup --skill threejs-josippapez
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: threejs
Source: https://github.com/josippapez/ai-setup/tree/main/claude/plugins/better-design/skills/threejs
Command: npx skills add https://github.com/josippapez/ai-setup --skill threejs-josippapez

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three.

What problem does it solve? Building interactive 3D scenes on the web involves many moving parts—scene graphs, cameras, renderers, asset loading, and performance tuning—and small mistakes like unhandled resizes or undisposed resources cause visual bugs and crashes. ## Core Features & Use Cases - Scene Setup Guidance: Covers the core Three.js mental model (Scene, Camera, WebGLRenderer, Mesh, lights) and the requestAnimationFrame render loop. - Asset Loading & Controls: Explains GLTFLoader, TextureLoader, DRACOLoader, and common controls like OrbitControls and PointerLockControls. - Pitfall Prevention: Addresses resize handling, devicePixelRatio limits, WebGL resource disposal in SPAs, and reduced-motion accessibility. - Use Case: A designer shipping an interactive product-spin hero section can use the included minimal spinning-cube recipe, then apply the cleanup and performance checklists before deploying to mobile. ## Quick Start Ask the AI to create a minimal Three.js scene with a spinning cube that handles window resizing and respects reduced-motion preferences.

Frequently Asked Questions about threejs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a basic Three.js scene with a spinning object?

Create a WebGLRenderer bound to a canvas, a Scene, and a PerspectiveCamera, then add a Mesh combining Geometry and Material with lights. Drive animation with requestAnimationFrame, updating rotation each frame before calling renderer.render(scene, camera).

How do I load 3D models in Three.js?

Use GLTFLoader for glTF models, TextureLoader for images, and DRACOLoader for Draco-compressed glTF files. For production, prefer compressed textures and KTX2 or Draco to reduce download size and startup time.

Why does my Three.js canvas look stretched after resizing the window?

Stretched rendering happens when resize events are not handled. On resize, call renderer.setSize with the canvas client dimensions, update camera.aspect to width divided by height, and call camera.updateProjectionMatrix().

Why does my Three.js app crash after navigating between pages?

Crashes after route changes usually come from leaked WebGL resources. In SPAs you must call geometry.dispose(), material.dispose(), texture.dispose(), and renderer.dispose(), remove event listeners, and cancel the animation frame loop.

How do I improve Three.js performance on mobile devices?

Cap pixel ratio with Math.min(window.devicePixelRatio, 2), reduce texture and model sizes, and limit lights and shadows. Fake lighting with baked textures when possible, since many dynamic lights are expensive on mobile GPUs.

How do I respect prefers-reduced-motion in a Three.js scene?

Check the prefers-reduced-motion media query and, when set, render a single still frame instead of running the requestAnimationFrame loop, or significantly slow down time-based updates.