threejs-fundamentals

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

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/X-manist/Cohmira --skill threejs-fundamentals-x-manist
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: threejs-fundamentals
Source: https://github.com/X-manist/Cohmira/tree/main/src/builtin-plugins/openmontage/.agents/skills/threejs-fundamentals
Command: npx skills add https://github.com/X-manist/Cohmira --skill threejs-fundamentals-x-manist

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 correct, ready-to-use patterns for the core Three.js building blocks. ## Core Features & Use Cases - Scene and Renderer Setup: Configure WebGLRenderer with tone mapping, color space, shadows, and pixel ratio, plus scene backgrounds, fog, and environment maps. - Camera Configuration: Create Perspective, Orthographic, Array, and Cube cameras with correct projection settings and resize handling. - Object Hierarchy and Math: Manage Object3D transforms, groups, layers, and use Vector3, Matrix4, Quaternion, Euler, and Color utilities. - Use Case: You are building a 3D product viewer for an e-commerce page. Use this Skill to scaffold the scene, add lighting and shadows, wire up a responsive canvas, and follow proper disposal patterns to avoid GPU memory leaks. ## Quick Start Ask the AI to create a Three.js scene with a perspective camera, an animated rotating cube, lighting, 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 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 suits most 3D scenes. OrthographicCamera has no perspective distortion, making it better for 2D layouts, isometric views, and CAD-style rendering.

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 sharp 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, remove meshes from the scene, and call renderer.dispose() when tearing down.

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

Use THREE.Clock and multiply movement by clock.getDelta() each frame instead of fixed increments. This makes rotation and motion speed independent of the display refresh rate.