threejs-fundamentals

Set up Three.js scenes, cameras, renderers, and Object3D hierarchies for 3D web graphics.

Updated Aug 12, 2026
One-click install
npx skills add https://github.com/brunoolf/frontend-craft --skill threejs-fundamentals-brunoolf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: threejs-fundamentals
Source: https://github.com/brunoolf/frontend-craft/tree/main/skills/threejs-fundamentals
Command: npx skills add https://github.com/brunoolf/frontend-craft --skill threejs-fundamentals-brunoolf

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, resize handling, and resource cleanup—and getting any of them wrong produces blank canvases, distorted views, or memory leaks. This Skill provides working reference patterns for the core Three.js API so you can build correct 3D scenes without digging through documentation. ## Core Features & Use Cases - Scene and Renderer Setup: Ready-to-use patterns for Scene, WebGLRenderer, tone mapping, color space, shadows, and responsive canvas resizing. - Camera and Object Hierarchy: Covers PerspectiveCamera, OrthographicCamera, CubeCamera, Object3D transforms, groups, layers, and the right-handed coordinate system. - Math and Performance Utilities: Vector3, Matrix4, Quaternion, Euler, Color, MathUtils, plus cleanup, clock-based animation, geometry merging, and LOD patterns. - Use Case: You need a rotating product viewer on a landing page. Use this Skill to scaffold the scene, camera, lighting, animation loop, and resize handler, then dispose of resources cleanly when the component unmounts. ## Quick Start Ask the AI to create a Three.js scene with a perspective camera, an animated lit cube, and proper resize handling using this skill.

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 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 the human eye with depth foreshortening and suits most 3D scenes. OrthographicCamera has no perspective distortion, making it appropriate for 2D layouts, isometric views, and technical diagrams.

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. Cap pixel ratio with Math.min(window.devicePixelRatio, 2) to avoid over-rendering on high-DPI screens.

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 scene.

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

Use THREE.Clock and multiply movement by clock.getDelta(), the elapsed seconds since the last frame. This makes rotation and motion speed independent of the device's refresh rate.

How can I reduce draw calls in a Three.js scene?

Merge static geometries with mergeGeometries from BufferGeometryUtils, use instancing for repeated meshes, and apply THREE.LOD to swap in lower-detail meshes at distance. Frustum culling is enabled by default for off-screen meshes.