three.js Examples Explained
12 small, self-contained examples using three.js r187. Each runs in the browser with no build step and has a line-by-line explanation.
-
01. First cube
Scene, camera, renderer, mesh and an animation loop.
-
02. Lights and shadows
Hemisphere and directional light, PBR materials, soft shadows.
-
03. Orbit controls and helpers
Drag to rotate, right-drag to pan, scroll to zoom.
-
04. Textures from a canvas
CanvasTexture, color space, wrapping, repeat and filtering.
-
05. Custom geometry
A BufferGeometry terrain built from raw vertex data, animated per frame.
-
06. 10,000 cubes with InstancedMesh
One draw call for thousands of objects.
-
07. Hover and click with Raycaster
Hover to highlight, click to select.
-
08. Load a glTF model
GLTFLoader, environment lighting, auto-fit camera.
-
09. Scene graph: a tiny solar system
Parent/child transforms. Press Space to pause.
-
10. Particle galaxy
20,000 points with additive blending.
-
11. Custom GLSL shader
Vertex displacement and a color gradient with uniforms.
-
12. Bloom post-processing
EffectComposer, UnrealBloomPass and OutputPass.