Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsApr 11, 2026·2 min de lectura

Three.js — JavaScript 3D Library for the Web

Three.js is the most popular 3D library for JavaScript — WebGL/WebGPU rendering made accessible. Build 3D scenes, models, shaders, physics, VR/AR, and interactive experiences without touching low-level graphics APIs.

Introducción

Three.js is the most widely used 3D library for JavaScript, created by Ricardo Cabello (mrdoob) in 2010. It abstracts WebGL (and the new WebGPU backend) into an approachable scene graph API — Scene, Camera, Mesh, Material, Light — while still exposing low-level shader control.

What Three.js Does

  • Scene graph — nested objects with transforms
  • Geometries — box, sphere, plane, custom, glTF/OBJ/FBX loaders
  • Materials & shaders — PBR, custom GLSL
  • Lighting — directional, point, spot, IBL
  • Post-processing — bloom, SSAO, DOF
  • Animation — keyframes, skeletal, morph targets
  • Physics — via Rapier, Cannon, Ammo integrations
  • VR/AR — WebXR module
  • WebGPU — experimental next-gen backend

Architecture

Single scene graph with a renderer that walks the tree each frame. Each Object3D has position/rotation/scale matrices. Materials map to shaders; geometries hold vertex data in GPU buffers. renderer.render(scene, camera) does the GL calls.

Self-Hosting

Client library — ships with your app.

Key Features

  • WebGL + experimental WebGPU renderer
  • 40+ geometries & materials
  • glTF/OBJ/FBX/STL/PLY/DRACO loaders
  • Skeletal animation
  • Post-processing pipeline
  • WebXR (VR/AR)
  • Shadow mapping
  • Ray casting for picking
  • Cameras: Perspective, Orthographic, Cube

Comparison

Library Focus Bundle React Wrapper
Three.js General 3D ~600KB React Three Fiber
Babylon.js Games/Enterprise ~1MB None
Pixi.js 2D WebGL ~200KB @pixi/react
PlayCanvas Editor-based games ~400KB None

FAQ

Q: How do I integrate with React? A: Use React Three Fiber (R3F) — declarative JSX for Three.js scenes. The ecosystem also includes drei (utilities) and rapier (physics).

Q: WebGL vs WebGPU? A: WebGL is the web port of OpenGL ES and is stable. WebGPU is the next-generation API (close to Metal/Vulkan); Chrome and Safari support it, and Three.js has an experimental renderer.

Q: How do I optimize performance? A: Reduce draw calls (InstancedMesh), merge geometries, use KTX2/Draco compression, and disable shadows.

Sources & Credits

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados