threejs-fundamentals

Set up Three.js scenes, cameras, renderers, and Object3D hierarchies with coordinate transforms.

Updated Jun 30, 2026
One-click install
npx skills add https://github.com/ayofemiade/cleva --skill threejs-fundamentals-ayofemiade
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: threejs-fundamentals
Source: https://github.com/ayofemiade/cleva/tree/main/.claude/skills/threejs-fundamentals
Command: npx skills add https://github.com/ayofemiade/cleva --skill threejs-fundamentals-ayofemiade

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three.

What problem does it solve? Setting up a Three.js scene involves many interdependent pieces—scene graph, camera configuration, renderer options, lighting, and resize handling—and getting any of them wrong produces blank screens or broken rendering. This Skill provides working code patterns and API references for the core Three.js building blocks so you can bootstrap and manage 3D scenes correctly. ## Core Features & Use Cases - Scene & Renderer Setup: Ready-to-use patterns for WebGLRenderer configuration including tone mapping, color space, shadows, and pixel ratio handling. - Camera & Object Hierarchy Management: Covers PerspectiveCamera, OrthographicCamera, CubeCamera, Object3D transforms, groups, layers, and traversal. - Math & Performance Utilities: Vector3, Matrix4, Quaternion, Euler, Color, and MathUtils operations plus cleanup, clock-based animation, and LOD patterns. - Use Case: You are building a 3D product viewer in a Next.js app and need a responsive canvas with a rotating mesh, proper lighting, and clean disposal when the component unmounts. ## Quick Start Set up a basic Three.js scene with a perspective camera, a lit rotating cube, and window resize handling.

Frequently Asked Questions about threejs-fundamentals

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

FAQPage Schema
How do I set up a basic Three.js scene with camera and renderer?▼

Create a THREE.Scene, a PerspectiveCamera with fov, aspect, near, and far values, and a WebGLRenderer with antialias enabled. Set the renderer size and pixel ratio, append its DOM element, add meshes and lights to the scene, then call renderer.render inside a requestAnimationFrame loop.

What is the difference between PerspectiveCamera and OrthographicCamera in Three.js?▼

PerspectiveCamera simulates human-eye depth with a field of view and is the most common choice for 3D scenes. OrthographicCamera has no perspective distortion, making it suitable for 2D views, isometric projections, and technical diagrams.

How do I handle window resize in Three.js?▼

Add a resize event listener that updates camera.aspect with the new width-to-height ratio, calls camera.updateProjectionMatrix(), and resizes the renderer with renderer.setSize. Also reapply setPixelRatio capped at 2 for consistent rendering on high-DPI displays.

Why does my Three.js animation speed vary between devices?▼

Frame-rate-dependent updates cause inconsistent speeds across devices. Use THREE.Clock to get the delta time between frames and multiply rotations or movements by that delta, ensuring consistent motion regardless of framerate.

How do I properly dispose of Three.js objects to prevent memory leaks?▼

Call dispose() on geometries, materials (including arrays of materials), and textures, then remove objects from the scene and call renderer.dispose(). This releases GPU resources that JavaScript garbage collection cannot reclaim automatically.

What coordinate system does Three.js use?▼

Three.js uses a right-handed coordinate system where +X points right, +Y points up, and +Z points toward the viewer out of the screen. You can visualize the axes with THREE.AxesHelper, which shows red for X, green for Y, and blue for Z.