A complete guide to the Three.js Interactive 3D Examples collection
๐๏ธ Where are you on the 3D journey?
"I've never written a line of WebGL."
| Step | What | Time |
|---|---|---|
| 1๏ธโฃ | Understand the concepts | 5 min |
| 2๏ธโฃ | Run your first cube | 3 min |
| 3๏ธโฃ | Modify the demo | 5 min |
| 4๏ธโฃ | Explore basics folder | 20 min |
"I want beautiful visuals."
| Step | What | Time |
|---|---|---|
| 1๏ธโฃ | Shader examples | 15 min |
| 2๏ธโฃ | Post-processing | 10 min |
| 3๏ธโฃ | Material showcase | 10 min |
"I want interaction and physics."
| Step | What | Time |
|---|---|---|
| 1๏ธโฃ | Control patterns | 10 min |
| 2๏ธโฃ | Physics demos | 10 min |
| 3๏ธโฃ | Game demo | 15 min |
"Performance and architecture matter."
| Step | What | Time |
|---|---|---|
| 1๏ธโฃ | Instanced rendering | 10 min |
| 2๏ธโฃ | Custom builds | 10 min |
| 3๏ธโฃ | Optimization guide | 15 min |
Three.js Interactive 3D Examples is a curated collection of 50+ standalone, copy-pasteable demos covering every major feature of Three.js โ the most popular WebGL library for 3D graphics in the browser.
Every example is:
- โ Self-contained โ one HTML file (or a tiny folder)
- โ Commented โ line-by-line explanations
- โ Modern โ ES modules, up-to-date Three.js
- โ Responsive โ works on desktop and mobile
- โ Extendable โ fork, tweak, learn
Whether you're building a product configurator, a data visualization, a game prototype, or a portfolio piece โ these examples are designed to get you from "hello world" to "hello 3D" in minutes.
| Category | Count | Examples |
|---|---|---|
| ๐จ Basics | 8 | Cube, sphere, lights |
| ๐ญ Materials | 6 | PBR, toon, glass |
| ๐ Shaders | 8 | GLSL, noise, gradients |
| ๐ฎ Controls | 5 | Orbit, fly, first-person |
| ๐ฌ Animation | 6 | Keyframes, physics |
| โจ Post-FX | 5 | Bloom, blur, DOF |
| ๐ Data Viz | 4 | Bars, networks |
| ๐น๏ธ Game | 4 | Particles, collision |
| ๐งช Advanced | 4 | Instancing, LOD |
| Term | Meaning |
|---|---|
| ๐ฌ Scene | Root container |
| ๐ท Camera | Perspective or orthographic |
| ๐จ Renderer | WebGL context |
| ๐งฑ Mesh | Geometry + material |
| ๐ก Light | Illumination source |
| ๐ญ Material | Surface appearance |
| ๐ Animation Loop | Frame-by-frame updates |
| ๐ฆ Loader | GLTF, OBJ, texture import |
โ
OS: Any modern OS
โ
Browser: Chrome 90+, Firefox 88+, Edge 90+, Safari 14+
โ
GPU: WebGL 2.0 support
โ
RAM: 4 GB
โ
JavaScript: Enabled
โ
Internet: For CDN assets
โญ OS: Windows 11 / macOS 13+ / Ubuntu 22.04+
โญ Browser: Latest Chrome / Edge / Firefox
โญ GPU: Dedicated for heavy scenes
โญ RAM: 8 GB+
โญ Display: 1920ร1080+
โญ Editor: VSCode or similar
โญ Runtime: Node.js 20 LTS for local dev
| Browser | WebGL 2.0 | Notes |
|---|---|---|
| Chrome | โ | Full |
| Edge | โ | Full |
| Firefox | โ | Full |
| Safari | โ | macOS/iOS 15+ |
| Mobile Chrome | โ | Android 8+ |
| Mobile Safari | iOS 15+ only |
Click below to reach the instructions portal:
Open Source โข Educational โข Updated 2025
| Guide | Purpose |
|---|---|
| ๐ Getting Started | First demo |
| ๐ Shaders Guide | GLSL fundamentals |
| ๐ Animation Guide | Keyframes and easing |
| ๐ Performance Guide | Optimize scenes |
| ๐ Deployment Guide | Host your demo |
Open the official setup guide from the button above.
git clone https://github.com/your-org/threejs-interactive-3d-examples.git
cd threejs-interactive-3d-examplesnpx serve .Navigate to http://localhost:3000/examples/basics/01-cube.html.
If WebGL is working, you'll see a rotating cube.
Every line is commented โ read from top to bottom.
Find 0x00ff00 and change to 0xff0080 โ save and refresh.
Find 0.01 in the animation loop and increase to 0.05.
Try changing the shape, the camera position, the light color.
Copy the file to a new folder and start your own project.
| Change | What You Learn |
|---|---|
| ๐จ Color | Materials |
| ๐ Geometry | Shapes |
| ๐ก Light type | Lighting |
| ๐ Rotation | Animation |
| ๐ท Camera FOV | Projection |
| ๐ซ๏ธ Fog | Atmosphere |
- ๐ Change one variable โ observe the effect
- ๐ Comment out lines โ see what breaks
- ๐งช Guess before running โ build intuition
- ๐ Read the docs โ deepen understanding
- ๐ Rebuild from scratch โ reinforce memory
| # | File | Concepts |
|---|---|---|
| 01 | cube.html |
Scene, camera, renderer |
| 02 | lighting.html |
Ambient, directional, point |
| 03 | materials.html |
Standard, toon, wireframe |
| 04 | geometries.html |
Box, sphere, torus, planes |
| 05 | textures.html |
Loading images |
| 06 | shadows.html |
Soft shadows |
| 07 | groups.html |
Hierarchies |
| 08 | responsive.html |
Resize handling |
| # | File | Concepts |
|---|---|---|
| 09 | pbr.html |
Physically-based rendering |
| 10 | glass.html |
Transmission, roughness |
| 11 | toon.html |
Stylized shading |
| 12 | emissive.html |
Glowing objects |
| 13 | gradient.html |
Vertex colors |
| 14 | hologram.html |
Custom shader |
| # | File | Concepts |
|---|---|---|
| 15 | shader-basic.html |
Vertex + fragment |
| 16 | shader-noise.html |
Perlin noise |
| 17 | shader-plasma.html |
Animated patterns |
| 18 | shader-water.html |
Wave simulation |
| 19 | shader-fire.html |
Fractal noise |
| 20 | shader-sky.html |
Atmospheric scattering |
| 21 | shader-particles.html |
GPU particles |
| 22 | shader-raymarch.html |
Raymarching in GLSL |
| # | File | Concepts |
|---|---|---|
| 23 | orbit.html |
OrbitControls |
| 24 | fly.html |
FlyControls |
| 25 | first-person.html |
Pointer lock |
| 26 | drag.html |
Drag-and-drop objects |
| 27 | mobile.html |
Touch gestures |
| # | File | Concepts |
|---|---|---|
| 28 | keyframes.html |
AnimationMixer |
| 29 | morph.html |
Morph targets |
| 30 | skeletal.html |
Skinned meshes |
| 31 | spring.html |
Spring physics |
| 32 | physics.html |
Cannon-es integration |
| 33 | timeline.html |
Animation sequencing |
| # | File | Concepts |
|---|---|---|
| 34 | bloom.html |
Glow effect |
| 35 | dof.html |
Depth of field |
| 36 | blur.html |
Gaussian blur |
| 37 | chromatic.html |
Chromatic aberration |
| 38 | composer.html |
Multi-pass effects |
| # | File | Concepts |
|---|---|---|
| 39 | bars3d.html |
3D bar chart |
| 40 | network.html |
Force-directed graph |
| 41 | globe.html |
Rotating globe |
| 42 | heatmap.html |
3D heatmap |
| # | File | Concepts |
|---|---|---|
| 43 | particles.html |
Instanced particles |
| 44 | collision.html |
Basic collision |
| 45 | score.html |
UI overlays |
| 46 | controls-game.html |
Character controls |
| # | File | Concepts |
|---|---|---|
| 47 | instancing.html |
InstancedMesh |
| 48 | lod.html |
Level of detail |
| 49 | gltf-loader.html |
Load 3D models |
| 50 | worker.html |
Offload to WebWorker |
| Check | Method | Expected |
|---|---|---|
| โ Local server runs | npx serve |
Port 3000 |
| โ Cube demo | Open | Cube spins |
| โ Controls work | Drag mouse | Camera moves |
| โ Shader compiles | F12 console | No errors |
| โ Mobile responsive | Resize | Fits |
| โ GLTF loads | Loader demo | Model appears |
| โ FPS stable | Chrome devtools | 60 FPS |
| โ No console errors | F12 | Clean |
| Problem | Cause | Solution |
|---|---|---|
| ๐ซ Black screen | WebGL disabled | Enable in browser |
| ๐ซ CORS error | Local file | Use local server |
| ๐ซ Texture missing | Wrong path | Check URL |
| ๐ซ Low FPS | Heavy scene | Reduce quality |
| ๐ซ Shader fails | Syntax | Check console |
| ๐ซ Model doesn't load | Format | Use GLTF/GLB |
| ๐ซ Mobile issues | GPU limit | Simplify scene |
| ๐ซ Shadows flicker | Bias | Tune shadow bias |
| ๐ซ Controls not working | Missing import | Check module path |
| ๐ซ Memory leak | No dispose | Call .dispose() |
// In browser console
renderer.dispose();
scene.clear();const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, w/h, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(w, h);
document.body.appendChild(renderer.domElement);const geo = new THREE.BoxGeometry(1, 1, 1);
const mat = new THREE.MeshStandardMaterial({ color: 0x00ff00 });
const mesh = new THREE.Mesh(geo, mat);
scene.add(mesh);const light = new THREE.DirectionalLight(0xffffff, 1);
light.position.set(1, 1, 1);
scene.add(light);function animate() {
requestAnimationFrame(animate);
mesh.rotation.y += 0.01;
renderer.render(scene, camera);
}
animate();import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
const loader = new GLTFLoader();
loader.load('model.glb', (gltf) => scene.add(gltf.scene));| Resource | Purpose |
|---|---|
| ๐ Three.js Docs | Official reference |
| ๐ Three.js Journey | Paid course |
| ๐ฌ Discord | Community |
| ๐ GitHub Issues | Bug reports |
| ๐ฅ YouTube | Video tutorials |
Is Three.js free? Yes โ MIT-licensed.
Do I need Node.js? No โ examples work with any static server.
Can I use these in production? Yes โ copy, modify, ship.
Do they work on mobile? Yes โ with WebGL 2.0 support.
Which browser is best? Chrome or Edge for dev tools.
Can I add physics?
Yes โ see the physics.html demo.
What about VR? Three.js supports WebXR.
Do examples need images? Some do โ served from CDN.
Can I use TypeScript? Yes โ Three.js has official types.
How do I host these? GitHub Pages, Netlify, Vercel โ all work.
| Version | Date | Highlights |
|---|---|---|
| 2025.1 | Jan 2025 | 50 examples, ES modules |
| 2024.4 | Oct 2024 | Shader collection |
| 2024.2 | Jun 2024 | Physics demo |
| 2024.1 | Feb 2024 | Initial release |
