What You'll Learn in This Three.js Guide
This free interactive guide teaches you Three.js — the most popular JavaScript library for 3D web graphics. Every concept comes with a live interactive demo you can manipulate in real-time, plus code examples you can copy directly into your projects.
01 — Geometry
Geometry defines the shape of 3D objects using vertices, edges, and faces. Everything in Three.js is a BufferGeometry — typed arrays of vertex data sent directly to the GPU. Three.js ships 21 built-in geometry constructors including BoxGeometry, SphereGeometry, CylinderGeometry, TorusGeometry, LatheGeometry, ExtrudeGeometry, and more. Adjust segment counts to control smoothness vs. performance.
02 — Materials
Materials control how objects look — color, shininess, transparency, and how they respond to light. The material hierarchy goes from MeshBasicMaterial (unlit, cheapest) to MeshLambertMaterial (diffuse) to MeshPhongMaterial (specular) to MeshStandardMaterial (PBR with roughness/metalness) to MeshPhysicalMaterial (clearcoat, transmission, iridescence, sheen). Other types include MeshToonMaterial for cel-shading and MeshMatcapMaterial for texture-based lighting.
03 — Cameras
The camera defines how 3D space is projected onto your 2D screen. PerspectiveCamera mimics human vision with depth — farther objects appear smaller. OrthographicCamera has no perspective distortion — used for isometric games, CAD, and technical views. This section includes 10 real-world camera presets: Free Orbit, First Person, Third Person, Top Down, Racing, Side Scroller, Isometric, Cinematic, Bird's Eye, and Security Cam.
04 — Lighting
Lighting makes a 3D scene feel real. Three.js offers DirectionalLight (sun), PointLight (light bulb), SpotLight (cone beam), HemisphereLight (sky + ground ambient), RectAreaLight (soft panel), and AmbientLight (uniform fill). Learn three-point lighting setups, shadow configuration, and how each light type affects PBR materials differently.
05 — Scene Objects
Everything in a Three.js scene is an Object3D. A Mesh combines geometry + material. InstancedMesh draws thousands of copies in one GPU draw call. Points renders particle systems. Group creates parent-child hierarchies. Sprite creates billboards that always face the camera. LOD automatically switches detail levels based on distance.
06 — Controls
Controls translate user input into camera movement. OrbitControls is the default for model viewers. MapControls for top-down maps. FlyControls for free-flight navigation. FirstPersonControls for FPS-style games. TrackballControls for unconstrained rotation. Each has configurable damping, speed limits, and distance constraints.
07 — Post-Processing
EffectComposer chains screen-space effects after the scene renders. Stack passes like UnrealBloomPass (glow), FilmPass (grain), GlitchPass (distortion), AfterimagePass (motion trails), DotScreenPass (halftone), plus custom ShaderPass for vignette and pixelation. Order matters — always start with RenderPass and end with OutputPass.
08 — Style Gallery
One scene, 16 looks. The same tree and house rendered in completely different visual styles: Realistic PBR, Clay, Low-Poly, Toon, Wireframe, Normals, Neon, Glass, Pixel Art, Isometric Voxel, Matcap, X-Ray, Blueprint, Hologram, Gold/Chrome, and Sunset. Each style demonstrates different Three.js techniques — materials, camera types, lighting, and post-processing.