threejs-fundamentals

Configure Three.js scenes, cameras, renderers, and Object3D hierarchies for 3D web applications.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/Aadi-110i/PEP-PROJECT --skill threejs-fundamentals-aadi-110i
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: threejs-fundamentals
Source: https://github.com/Aadi-110i/PEP-PROJECT/tree/main/skills/threejs-fundamentals
Command: npx skills add https://github.com/Aadi-110i/PEP-PROJECT --skill threejs-fundamentals-aadi-110i

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three.

What problem does it solve? Setting up a Three.js scene involves many interdependent pieces—cameras, renderers, lights, object hierarchies, and math utilities—and getting any of them wrong leads to blank screens, distorted views, or memory leaks. This Skill provides working code patterns and API references for the core Three.js building blocks. ## Core Features & Use Cases - Scene and Renderer Setup: Ready-to-use patterns for WebGLRenderer configuration including tone mapping, color space, shadows, and pixel ratio handling. - Camera Selection: Guidance on PerspectiveCamera, OrthographicCamera, ArrayCamera, and CubeCamera with correct constructor parameters and update patterns. - Object Hierarchy and Math: Object3D transforms, Group organization, and Vector3/Matrix4/Quaternion operations for positioning and animating objects. - Use Case: You are building an interactive 3D product viewer and need a responsive canvas, proper lighting, smooth animation with a clock, and correct cleanup to avoid GPU memory leaks. ## Quick Start Set up a basic Three.js scene with a perspective camera, a lit rotating cube, and responsive 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?

Create a THREE.Scene, a PerspectiveCamera with fov, aspect, near, and far values, and a WebGLRenderer with antialias enabled. 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 vision with depth-based foreshortening and is the default for most 3D scenes. OrthographicCamera removes perspective distortion, making it suitable for 2D views, isometric projections, and CAD-style interfaces.

How do I handle window resize in Three.js?

Update camera.aspect with the new width-to-height ratio, call camera.updateProjectionMatrix(), then call renderer.setSize with the new dimensions. Also reset the pixel ratio with Math.min(window.devicePixelRatio, 2) for consistent rendering.

Why does my Three.js app leak memory over time?

Geometries, materials, and textures hold GPU resources that are not freed automatically. Call dispose() on each geometry, material, and texture when removing objects, and call renderer.dispose() when tearing down the renderer.

How do I make Three.js animation speed consistent across framerates?

Use THREE.Clock and multiply movement by clock.getDelta(), which returns seconds elapsed since the last frame. This makes rotation and position changes frame-rate independent instead of tying speed to requestAnimationFrame frequency.