Three.js icon

Three.js

Standard softwareFOSS · MIT

Ubiquitous MIT 3D WebGL2 and WebGPU JavaScript library

Free (MIT) · Mr.doob & Contributors · Standard software workflow; Steam AI disclosure does not apply.

AI
Standard
IP
Commercial-Safe IP
Engines
Web / JS
Platforms
Web · CLI
Version
r171
Technical Summary

Three.js is an MIT-licensed open-source 3D JavaScript and TypeScript rendering library for WebGL2 and WebGPU browsers. Free for commercial use with zero royalties, it handles glTF 2.0 PBR scenes, Draco/KTX2 compression, node shaders, and WebXR, serving as the core renderer behind React Three Fiber and browser 3D games.

Technical Overview

Architecture and Production Workflow

Three.js (r171+) provides a lean retained-mode 3D scene graph (Scene, PerspectiveCamera, Mesh, SkinnedMesh, InstancedMesh, BatchedMesh) over both WebGLRenderer and the modern WebGPURenderer. With Three.js Shading Language (TSL), graphics programmers author procedural materials and compute passes once in a composable JavaScript/TypeScript node graph that compiles automatically to WGSL on WebGPU browsers and GLSL 3.00 ES on WebGL2 fallback devices. InstancedMesh and BatchedMesh collapse thousands of distinct environment props into single GPU draw calls with frustum and per-instance visibility culling.

The asset pipeline standardizes around Khronos glTF 2.0 via GLTFLoader, supporting physically based metallic-roughness, clearcoat, transmission, anisotropy, skeletal skinning, and morph targets. Pairing GLTFLoader with DRACOLoader, MeshoptDecoder, and KTX2Loader shrinks 100 MB raw scenes down to sub-10 MB network transfers that transcode directly into BC7, ASTC, or ETC2 compressed GPU memory without spiking browser RAM. Because Three.js intentionally stays focused on rendering rather than imposing a monolithic engine architecture, game teams compose their own stack using @dimforge/rapier3d (WASM physics), three-mesh-bvh (raycasting), recast-navigation-js (navmeshes), and React Three Fiber or Miniplex ECS.

Pricing, Licensing, and Commercial Rights

Three.js is distributed under the permissive MIT license at $0 cost and 0% royalties for all commercial games, WebXR experiences, enterprise configurators, and Electron/Tauri Steam releases. All official addons in three/addons/ carry the same commercial-safe MIT terms.

Strengths and Tradeoffs in Studio Pipelines

Pipeline DimensionProduction StrengthPractical Limitation
Bundle Weight & ControlTree-shakeable ES modules (~150 KB gzipped core) with zero forced editor lock-inNot a full game engine; teams must wire physics, audio, UI, and asset states themselves
Modern Web GraphicsUnified WebGPU + WebGL2 backend, TSL node shaders, and GPU compute buffersFrequent monthly rXXX releases deprecate legacy APIs quickly if package.json is unpinned
Ecosystem DepthMassive ecosystem including React Three Fiber, drei, pmndrs/postprocessing, and gltfjsxManual .dispose() calls on geometries, textures, and materials are required to prevent VRAM leaks

Run every Blender .glb export through gltf-transform optimize --compress meshopt --texture-compress webp (or uastc KTX2) before loading into Three.js to cut mobile browser crashes and initial load latency.

AI Transparency & Steam Disclosure

Standard Software

Procedural math, physics, or manual authoring software.

Steamworks guidance: Standard software workflow; Steam AI disclosure does not apply.

Technical FAQ about Three.js

How does Three.js compare to Babylon.js and PlayCanvas for 3D web games?
Three.js is a modular rendering library with a smaller core bundle and the entire React Three Fiber ecosystem, making it ideal when engineers want custom ECS/physics architecture. Choose Babylon.js if you want built-in Havok physics and backward compatibility, or PlayCanvas for a collaborative browser scene editor.
How do you prevent GPU memory leaks when switching levels in Three.js?
JavaScript garbage collection does not automatically free WebGL or WebGPU buffers. When unloading a level in Three.js, traverse the scene graph and explicitly invoke `geometry.dispose()`, `material.dispose()`, and `texture.dispose()` on every asset not shared across the next stage.
What is the best physics engine to pair with Three.js in 2026?
Dimforge's `@dimforge/rapier3d-compat` (or `@react-three/rapier` in React Three Fiber) and `jolt-physics` WebAssembly builds are the top production choices for browser 3D games. Both run deterministic SIMD-accelerated C++ or Rust collision solvers in WASM at multi-thousand rigid-body scales, far outperforming older pure-JS engines like Cannon-es.

More tools like Three.js