$ show mrdoob/three.js
Three.js is a mature, production-grade JavaScript 3D library providing WebGL and WebGPU renderers, a comprehensive scene graph, and extensive tooling for 3D web applications. The codebase demonstrates exceptional architecture with a clean separation between core rendering (src/), the new node-based shader system TSL (Three.js Shading Language), and a vast ecosystem of addons in examples/jsm/. The library supports multiple renderers (WebGLRenderer, WebGPURenderer, CSS2DRenderer, CSS3DRenderer, SVGRenderer), a full animation system, physics integrations (Ammo, Rapier, Jolt), WebXR for AR/VR, and loaders for 30+ formats (GLTF, FBX, USD, OBJ, etc.). The TSL node system is a standout achievement - a compiler-like architecture that transpiles shader graphs to GLSL/WGSL with automatic differentiation, lighting models, and post-processing. The WebGPU backend shows deep GPU API expertise with pipeline management, bind groups, and descriptor reuse. Code quality is consistently high with strong typing patterns, comprehensive unit tests (200+ test files), and modern ES module architecture. The project is actively maintained with recent commits, semantic versioning, and CI/CD pipelines.
The LLM identified 9 files worth highlighting for reuse:
The TSL (Three.js Shading Language) node system is a sophisticated compiler-like architecture for building shaders as composable node graphs. It supports automatic differentiation, multiple lighting models (Physical, Toon, Basic), post-processing nodes, and transpiles to both GLSL (WebGL) and WGSL (WebGPU). The system includes NodeBuilder, NodeParser, NodeFunction, and a rich standard library of math, lighting, and display nodes. This is genuinely reusable as a standalone shader authoring system.
Complete WebGPU renderer implementation demonstrating deep GPU API expertise. Features reusable descriptor classes (GPURenderPipelineDescriptor, GPUBindGroupDescriptor, GPUComputePipelineDescriptor), pipeline caching with cache keys, bind group management, timestamp queries, and efficient resource binding. The WebGPUBackend orchestrates render passes, compute passes, and render bundles. This module could be extracted as a reference WebGPU engine implementation.
Production-grade GLTF loader supporting the full specification plus extensions (KHR_draco_mesh_compression, KHR_materials_variants, KHR_materials_transmission, KHR_materials_ior, KHR_materials_specular, KHR_materials_clearcoat, KHR_materials_sheen, KHR_materials_iridescence, KHR_materials_volume, KHR_materials_unlit, KHR_texture_basisu, KHR_texture_ktx2, EXT_mesh_gpu_instancing, EXT_texture_webp). Includes async parsing, DRACO/BasisU/KTX2 decompression, and a modular extension registry pattern.
Complete animation system with AnimationMixer (manages multiple clips), AnimationAction (controls playback), PropertyMixer (blends properties), and typed KeyframeTracks (Vector, Quaternion, Color, Number, String, Boolean). Supports additive blending, morph targets, and skeletal animation. The property binding system efficiently resolves animated properties by name/path. Reusable as a general-purpose animation engine.
Modular post-processing framework with EffectComposer (manages pass chain), RenderPass (scene render), ShaderPass (custom shaders), and 25+ specialized passes (FXAA, SSAO, Bloom, DOF, SSR, TAAR, Outline, etc.). Passes can share render targets, support MRT, and integrate with the new RenderPipeline/TSL system. The Pass base class provides a clean extension pattern.
Comprehensive camera control suite: OrbitControls (touch/mouse orbit/pan/zoom), TransformControls (gizmo for translate/rotate/scale), DragControls (object dragging), PointerLockControls (FPS), TrackballControls, FlyControls, FirstPersonControls, MapControls, ArcballControls. Each is a self-contained class with event handling, damping, and constraints. Reusable in any Three.js project.
Procedural content generators: CityGenerator (grid-based city blocks with SkyscraperGenerator towers and SidewalkGenerator), TreeGenerator (procedural trees with L-system-like branching), ForestGenerator (instanced tree placement), TerrainGenerator (heightmap-based terrain with splat maps), RollerCoaster (track geometry along curves). Each uses instanced rendering and TSL materials for performance.
High-performance line rendering system: Line2/LineSegments2 (fat lines with variable width, dash patterns, world-space thickness), LineGeometry/LineSegmentsGeometry (instanced line data), WireframeGeometry2 (wireframe from any geometry), LineMaterial (TSL-based with world-space width, dashed patterns, resolution-independent). Supports WebGL and WebGPU backends.
Clean physics engine integrations for Ammo.js (Bullet), Rapier (Rust/WASM), and Jolt Physics. Each provides a Physics class with world management, body creation helpers, debug visualization (RapierHelper), and sync loops. The abstractions allow swapping physics engines with minimal code changes. Includes character controllers, vehicle controllers, and ragdoll helpers.