# JavaScript 3D libraries

JavaScript 3D libraries draw three-dimensional scenes in the browser through WebGL or WebGPU. On every frame, a renderer draws the scene's camera, lights, and meshes onto a canvas element. These libraries draw the product viewers, globe maps, data visualizations, and browser games on the web.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [three.js](#three-js) | 133.8M | 118.6K | Oct 2026 | MIT |
| [React Three Fiber](#react-three-fiber) | 35.7M | 33.8K | Oct 2026 | MIT |
| [regl](#regl) | 5.1M | 5.6K | Nov 2024 | MIT |
| [ogl](#ogl) | 4.4M | 4.8K | Jan 2025 | Unlicense |
| [@splinetool/runtime](#splinetool-runtime) | 3.0M | Not on GitHub | Nov 2026 | Not declared |
| [CesiumJS](#cesiumjs) | 1.7M | 16.0K | Nov 2026 | Apache-2.0 |
| [Babylon.js](#babylonjs-core) | 1.6M | 26.4K | Nov 2026 | Apache-2.0 |
| [PlayCanvas](#playcanvas) | 712.8K | 17.3K | Nov 2026 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[three.js](#three-js) has the most monthly downloads in this comparison, at 133.8M.

## Capabilities

| Library | WebGPU renderer | Native React reconciler |
| --- | --- | --- |
| [three.js](#three-js) | Yes | No |
| [React Three Fiber](#react-three-fiber) | Yes | Yes |
| [regl](#regl) | No | No |
| [ogl](#ogl) | No | No |
| [@splinetool/runtime](#splinetool-runtime) | Yes | No |
| [CesiumJS](#cesiumjs) | No | No |
| [Babylon.js](#babylonjs-core) | Yes | No |
| [PlayCanvas](#playcanvas) | Yes | No |

## Libraries

### three.js

[GitHub](https://github.com/mrdoob/three.js) · [npm](https://www.npmjs.com/package/three) · [Docs](https://threejs.org/docs/)

Builds general-purpose browser scenes from cameras, geometry, materials, and renderers.

- Downloads / mo: 133.8M
- Stars: 118.6K
- Last release: 0.187.0
- License: MIT
- Capabilities: [From the three.js docs](https://threejs.org/docs/)

**Strengths**

- **Builds scenes from individual components.** Combine cameras, geometry, and materials to create a custom scene.
- **Supports WebGL and WebGPU rendering.** Choose the renderer that fits the application and target browser.

**Watch out for**

- **Physics needs an engine integration.** Synchronize scene meshes with a separate physics world for simulated collisions.
- **Compressed meshes need a decoder.** Attach DRACOLoader before loading Draco-compressed glTF meshes.

```sh
npm install three
```

**NASA-AMMOS/3DTilesRendererJS** (2.5K stars)

[NASA-AMMOS/3DTilesRendererJS](https://github.com/NASA-AMMOS/3DTilesRendererJS) 

```javascript
transformLatLonHeightToOrigin( lat, lon, height = 0, azimuth = 0, elevation = 0, roll = 0 ) {

		const { group, ellipsoid } = this.tiles;

		// get ENU orientation (Z facing north and X facing west) and position
		ellipsoid.getObjectFrame( lat, lon, height, azimuth, elevation, roll, group.matrix, OBJECT_FRAME );

		// adjust the group matrix
		group.matrix.invert().decompose( group.position, group.quaternion, group.scale );
		group.updateMatrixWorld();

	}

```

[src/three/plugins/ReorientationPlugin.js](https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/6f05f758914996f20cdb7f117f419c2ab8288476/src/three/plugins/ReorientationPlugin.js#L148-L159) · [More projects using three.js →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20using%20three%20for%20geographic%20model%20transforms%2C%20camera%20framing%20and%20synchronized%20globe%20navigation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import * as THREE from 'three';
const width = window.innerWidth, height = window.innerHeight;
const camera = new THREE.PerspectiveCamera( 70, width / height, 0.01, 10 );
camera.position.z = 1;
const scene = new THREE.Scene();
const geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
const material = new THREE.MeshNormalMaterial();
const mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( width, height );
renderer.setAnimationLoop( animate );
document.body.appendChild( renderer.domElement );
function animate( time ) {
	mesh.rotation.x = time / 2000;
	mesh.rotation.y = time / 1000;
	renderer.render( scene, camera );
}

```

From [README.md](https://github.com/mrdoob/three.js/blob/dev/README.md)

### React Three Fiber

[GitHub](https://github.com/pmndrs/react-three-fiber) · [npm](https://www.npmjs.com/package/@react-three/fiber) · [Docs](https://r3f.docs.pmnd.rs/api/canvas)

Renders three.js scenes from React components.

- Downloads / mo: 35.7M
- Stars: 33.8K
- Last release: 9.8.2
- License: MIT
- Capabilities: [From the React Three Fiber docs](https://r3f.docs.pmnd.rs/api/canvas)

```sh
npm install three @react-three/fiber
```

**pmndrs/drei** (10.2K stars)

[pmndrs/drei](https://github.com/pmndrs/drei) 

```javascript
export function useCubeCamera({ resolution = 256, near = 0.1, far = 1000, envMap, fog }: CubeCameraOptions = {}) {
  const gl = useThree(({ gl }) => gl)
  const scene = useThree(({ scene }) => scene)

  const fbo = useMemo(() => {
    const fbo = new WebGLCubeRenderTarget(resolution)
    fbo.texture.type = HalfFloatType
    return fbo
  }, [resolution])

  useEffect(() => {
    return () => {
      fbo.dispose()
    }
  }, [fbo])

  const camera = useMemo(() => new THREE.CubeCamera(near, far, fbo), [near, far, fbo])

  let originalFog
  let originalBackground
  const update = React.useCallback(() => {
    originalFog = scene.fog
    originalBackground = scene.background
    scene.background = envMap || originalBackground
    scene.fog = fog || originalFog
    camera.update(gl, scene)
    scene.fog = originalFog
    scene.background = originalBackground
  }, [gl, scene, camera])

  return {
    fbo,
    camera,
    update,
  }
}

```

[src/core/CubeCamera.tsx](https://github.com/pmndrs/drei/blob/bf6f4addf47467d3885de272d94ca5127f6ef68f/src/core/CubeCamera.tsx#L20-L55) · [More projects using React Three Fiber →](https://dashboard.exa.ai/playground/search?q=%40react-three/fiber%20GitHub%20projects)

**Quickstart**

```javascript
import React from 'react';
import { Canvas } from '@react-three/fiber';

export default function App() {
  return (
    <Canvas style={{ height: 300 }}>
      <ambientLight intensity={Math.PI / 2} />
      <mesh>
        <boxGeometry args={[1, 1, 1]} />
        <meshStandardMaterial color="orange" />
      </mesh>
    </Canvas>
  );
}

```

From [README.md](https://api.github.com/repos/pmndrs/react-three-fiber/contents/readme.md)

### regl

[GitHub](https://github.com/regl-project/regl) · [npm](https://www.npmjs.com/package/regl) · [Docs](https://regl-project.github.io/regl/)

Replaces the WebGL API with two abstractions: GPU resources and draw commands.

- Downloads / mo: 5.1M
- Stars: 5.6K
- Last release: 2.1.1
- License: MIT
- Capabilities: [From the regl docs](https://regl-project.github.io/regl/)

```sh
npm install regl
```

**rreusser/regl-gpu-lines** (190 stars)

[rreusser/regl-gpu-lines](https://github.com/rreusser/regl-gpu-lines) 

```javascript
function draw() {
  regl.poll();
  regl.clear({color: [0.2, 0.2, 0.2, 1]});
  drawLines([
    {...lineData, phase: 0, color: [1, 0, 0.5]},
    {...lineData, phase: Math.PI, color: [0, 0.5, 1]},
  ]);
}

```

[examples/knot.js](https://github.com/rreusser/regl-gpu-lines/blob/ec1cfb11ff3330461e0083215dbb5cb139129b5a/examples/knot.js#L79-L86) · [More projects using regl →](https://dashboard.exa.ai/playground/search?q=regl%20GitHub%20projects)

**Quickstart**

```javascript
const regl = require('regl')();
const drawTriangle = regl({
  frag: `
    precision mediump float;
    uniform vec4 color;
    void main() {
      gl_FragColor = color;
    }`,
  vert: `
    precision mediump float;
    attribute vec2 position;
    void main() {
      gl_Position = vec4(position, 0, 1);
    }`,
  attributes: {
    position: regl.buffer([[-1, -1], [1, -1], [0, 1]]),
  },
  uniforms: { color: regl.prop('color') },
  count: 3,
});
regl.clear({ color: [0, 0, 0, 1], depth: 1 });
drawTriangle({ color: [1, 0, 0, 1] });

```

From [README.md](https://cdn.jsdelivr.net/npm/regl@2.1.1/README.md)

### ogl

[GitHub](https://github.com/oframe/ogl) · [npm](https://www.npmjs.com/package/ogl) · [Docs](https://oframe.github.io/ogl/examples/)

Provides a small WebGL layer for developers who write their own shaders.

- Downloads / mo: 4.4M
- Stars: 4.8K
- Last release: 1.0.11
- License: Unlicense
- Capabilities: [From the ogl docs](https://oframe.github.io/ogl/examples/)

```sh
npm install ogl
```

**pmndrs/react-ogl** (220 stars)

[pmndrs/react-ogl](https://github.com/pmndrs/react-ogl) 

```javascript
function Controls() {
  const controls = React.useRef<OGL.Orbit>(null!)
  const gl = useOGL((state) => state.gl)
  const camera = useOGL((state) => state.camera)

  React.useEffect(() => {
    gl.canvas.classList.add('controls')
    return () => void gl.canvas.classList.remove('controls')
  }, [])

  useFrame(() => controls.current.update())

  return <orbit ref={controls} args={[camera, { element: gl.canvas, enableZoom: false }]} />
}

```

[examples/src/components/Controls.tsx](https://github.com/pmndrs/react-ogl/blob/3e30e09def191bf6a7737fb5e9fe2e85cc60fe99/examples/src/components/Controls.tsx#L5-L18) · [More projects using ogl →](https://dashboard.exa.ai/playground/search?q=ogl%20GitHub%20projects)

**Quickstart**

```javascript
import { Renderer, Camera, Transform, Box, Program, Mesh } from 'ogl';

const renderer = new Renderer();
const gl = renderer.gl;
renderer.setSize(640, 360);
document.body.appendChild(gl.canvas);
const camera = new Camera(gl);
camera.position.z = 5;
camera.perspective({ aspect: gl.canvas.width / gl.canvas.height });
const scene = new Transform();
const geometry = new Box(gl);
const program = new Program(gl, {
  vertex: `
    attribute vec3 position;
    uniform mat4 modelViewMatrix;
    uniform mat4 projectionMatrix;
    void main() {
      gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
    }
  `,
  fragment: `
    void main() {
      gl_FragColor = vec4(1.0);
    }
  `,
});
const mesh = new Mesh(gl, { geometry, program });
mesh.setParent(scene);
renderer.render({ scene, camera });

```

From [README.md](https://cdn.jsdelivr.net/npm/ogl@1.0.11/README.md)

### @splinetool/runtime

[npm](https://www.npmjs.com/package/@splinetool/runtime)

Loads scenes exported from the Spline editor and renders them in the browser.

- Downloads / mo: 3.0M
- Last release: 2.0.194
- License: Not declared
- Capabilities: [From the @splinetool/runtime docs](https://www.npmjs.com/package/@splinetool/runtime)

```sh
npm install @splinetool/runtime
```

**splinetool/react-spline** (1.4K stars)

[splinetool/react-spline](https://github.com/splinetool/react-spline) 

```javascript
async function init() {
          await speApp.load(scene);

          for (let event of events) {
            if (event.cb) {
              speApp.addEventListener(event.name, event.cb);
            }
          }

          setIsLoading(false);
          onLoad?.(speApp);
        }

```

[src/Spline.tsx](https://github.com/splinetool/react-spline/blob/0e93b105f2bbb4d0520bf6e98d20bfb650d36408/src/Spline.tsx#L143-L154) · [More projects using @splinetool/runtime →](https://dashboard.exa.ai/playground/search?q=%40splinetool/runtime%20GitHub%20projects)

**Quickstart**

```javascript
import { Application } from '@splinetool/runtime';
const canvas = document.getElementById('canvas3d');
const spline = new Application(canvas);
spline.load('https://prod.spline.design/6Wq1Q7YGyM-iab9i/scene.splinecode');

```

From [README.md](https://cdn.jsdelivr.net/npm/@splinetool/runtime@2.0.194/README.md)

### CesiumJS

[GitHub](https://github.com/CesiumGS/cesium) · [npm](https://www.npmjs.com/package/cesium) · [Docs](https://cesium.com/learn/cesiumjs/ref-doc/)

Displays geographic globes and maps with georeferenced models, terrain and interactive camera controls.

- Downloads / mo: 1.7M
- Stars: 16.0K
- Last release: 1.147.0
- License: Apache-2.0
- Capabilities: [From the CesiumJS docs](https://cesium.com/learn/cesiumjs/ref-doc/)

**Strengths**

- **Builds geographic globes and maps.** Use a geographic scene for world-scale visualizations.
- **Places models in geographic frames.** Transform local model coordinates into the globe’s world coordinate system.

**Watch out for**

- **Local models need a transform.** Set modelMatrix to place a local model on the globe.
- **Tutorial assets need a token.** Supply a Cesium ion token for the tutorial’s hosted terrain and buildings.

```sh
npm install cesium
```

**openlayers/ol-cesium** (1.2K stars)

[openlayers/ol-cesium](https://github.com/openlayers/ol-cesium) 

```javascript
setPosition(position: number[]) {
    if (!this.toLonLat_) {
      return;
    }
    const ll = this.toLonLat_(position);
    console.assert(!!ll);

    const carto = new Cesium.Cartographic(
      toRadians(ll[0]),
      toRadians(ll[1]),
      this.getAltitude(),
    );

    this.cam_.setView({
      destination: Cesium.Ellipsoid.WGS84.cartographicToCartesian(carto),
    });
    this.updateView();
  }

```

[src/olcs/Camera.ts](https://github.com/openlayers/ol-cesium/blob/5fe9a69943a20d7734f7d2e6efb35d0e54c552a8/src/olcs/Camera.ts#L202-L219) · [More projects using CesiumJS →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20using%20cesium%20for%20geographic%20model%20transforms%2C%20camera%20framing%20and%20synchronized%20globe%20navigation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import { Viewer } from "cesium";
import "cesium/Build/Cesium/Widgets/widgets.css";
const viewer = new Viewer("cesiumContainer");

```

From [README.md](https://cdn.jsdelivr.net/npm/cesium@1.147.0/README.md)

### Babylon.js

[GitHub](https://github.com/BabylonJS/Babylon.js) · [npm](https://www.npmjs.com/package/@babylonjs/core) · [Docs](https://doc.babylonjs.com/)

Publishes the Babylon.js engine as typed ES modules, with each class importable on its own.

- Downloads / mo: 1.6M
- Stars: 26.4K
- Last release: 9.37.1
- License: Apache-2.0
- Capabilities: [From the Babylon.js docs](https://doc.babylonjs.com/)

```sh
npm install @babylonjs/core
```

**BabylonJS/Editor** (1.1K stars)

[BabylonJS/Editor](https://github.com/BabylonJS/Editor) 

```javascript
export function getCameraFocusPositionFor(target: Vector3, camera: Camera, options: ICameraFocusPositionOptions) {
	const fov = camera.fov;
	const aspect = camera.getEngine().getAspectRatio(camera);
	const sizeVec = options.maximum.subtract(options.minimum);

	const verticalSize = sizeVec.y;
	const horizontalSize = sizeVec.x;

	const verticalDistance = verticalSize / 2 / Math.tan(fov / 2);
	const horizontalDistance = horizontalSize / 2 / Math.tan((fov * aspect) / 2);
	const idealDistance = Math.max(verticalDistance, horizontalDistance) * (options.distance ?? 2);

	const cameraPosition = camera.globalPosition.clone();
	cameraPosition.y = Math.abs(cameraPosition.y);

	const directionToMesh = cameraPosition.subtract(target).normalize();

	const position = target.add(directionToMesh.scale(idealDistance));
	position.y += sizeVec.y * 0.25;

	return position;
}

```

[editor/src/tools/camera/focus.ts](https://github.com/BabylonJS/Editor/blob/b8084320ef388440caee7e4eced4b4a8b143a68a/editor/src/tools/camera/focus.ts#L10-L31) · [More projects using Babylon.js →](https://dashboard.exa.ai/playground/search?q=%40babylonjs/core%20GitHub%20projects)

**Quickstart**

```javascript
import { Engine } from "@babylonjs/core/Engines/engine";
import { Scene } from "@babylonjs/core/scene";
import { Vector3 } from "@babylonjs/core/Maths/math.vector";
import { FreeCamera } from "@babylonjs/core/Cameras/freeCamera";
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight";
import { CreateSphere } from "@babylonjs/core/Meshes/Builders/sphereBuilder";
import { CreateGround } from "@babylonjs/core/Meshes/Builders/groundBuilder";
import "@babylonjs/core/Materials/standardMaterial";
const canvas = document.getElementById("renderCanvas") as HTMLCanvasElement;
const engine = new Engine(canvas);
const scene = new Scene(engine);
const camera = new FreeCamera("camera1", new Vector3(0, 5, -10), scene);
camera.setTarget(Vector3.Zero());
camera.attachControl(canvas, true);
const light = new HemisphericLight("light1", new Vector3(0, 1, 0), scene);
light.intensity = 0.7;
const sphere = CreateSphere("sphere1", { segments: 16, diameter: 2 }, scene);
sphere.position.y = 1;
CreateGround("ground1", { width: 6, height: 6, subdivisions: 2 }, scene);
engine.runRenderLoop(() => {
    scene.render();
});

```

From [README.md](https://cdn.jsdelivr.net/npm/@babylonjs/core@9.37.1/readme.md)

### PlayCanvas

[GitHub](https://github.com/playcanvas/engine) · [npm](https://www.npmjs.com/package/playcanvas) · [Docs](https://developer.playcanvas.com/)

Provides a browser graphics engine with entity components, animation and WebGPU or WebGL rendering.

- Downloads / mo: 712.8K
- Stars: 17.3K
- Last release: 2.24.2
- License: MIT
- Capabilities: [From the PlayCanvas docs](https://developer.playcanvas.com/)

**Strengths**

- **Runs independently of the Editor.** Use the engine directly in a JavaScript application.
- **Blends model animations through states.** Use the anim component to play clips and cross-fade between states.

**Watch out for**

- **Physics relies on ammo.js.** Load the physics integration when the scene needs rigid-body simulation.
- **Lights start with shadows disabled.** Enable shadow casting on lights before expecting objects to cast shadows.

```sh
npm install playcanvas
```

**playcanvas/supersplat** (10.7K stars)

[playcanvas/supersplat](https://github.com/playcanvas/supersplat) 

```javascript
private frameRay(frame: CameraFrame, x: number, y: number, ray: Ray) {
        invViewProj.mul2(frame.projection, frame.view).invert();
        const unproject = (z: number, out: Vec3) => {
            vec4.set(x * 2 - 1, 1 - y * 2, z, 1);
            invViewProj.transformVec4(vec4, vec4);
            return out.set(vec4.x / vec4.w, vec4.y / vec4.w, vec4.z / vec4.w);
        };
        unproject(1, vec);
        if (frame.ortho) {
            unproject(-1, vecb);
            ray.set(vecb, vec.sub(vecb).normalize());
        } else {
            ray.set(frame.position, vec.sub(frame.position).normalize());
        }
    }

```

[src/camera.ts](https://github.com/playcanvas/supersplat/blob/8b6af56d0b589095b8ab56a1c52444c1f84582af/src/camera.ts#L1044-L1058) · [More projects using PlayCanvas →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20using%20playcanvas%20for%20geographic%20model%20transforms%2C%20camera%20framing%20and%20synchronized%20globe%20navigation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import * as pc from 'playcanvas';
const canvas = document.createElement('canvas');
document.body.appendChild(canvas);
const device = await pc.createGraphicsDevice(canvas, {
  deviceTypes: [pc.DEVICETYPE_WEBGPU]
});
const options = new pc.AppOptions();
options.graphicsDevice = device;
options.componentSystems = [
  pc.RenderComponentSystem,
  pc.CameraComponentSystem,
  pc.LightComponentSystem
];
const app = new pc.AppBase(canvas);
app.init(options);
app.setCanvasFillMode(pc.FILLMODE_FILL_WINDOW);
app.setCanvasResolution(pc.RESOLUTION_AUTO);
window.addEventListener('resize', () => app.resizeCanvas());
const box = new pc.Entity('cube');
box.addComponent('render', { type: 'box' });
app.root.addChild(box);
const camera = new pc.Entity('camera');
camera.addComponent('camera', { clearColor: new pc.Color(0.1, 0.2, 0.3) });
camera.setPosition(0, 0, 3);
app.root.addChild(camera);
const light = new pc.Entity('light');
light.addComponent('light');
light.setEulerAngles(45, 0, 0);
app.root.addChild(light);
app.on('update', dt => box.rotate(10 * dt, 20 * dt, 30 * dt));
app.start();

```

From [README.md](https://cdn.jsdelivr.net/npm/playcanvas@2.24.2/README.md)

## FAQ

### Three.js vs Babylon.js: what is the difference?

[three.js](#three-js) composes a scene from separate cameras, geometry, materials, and renderers. [Babylon.js](#babylonjs-core) is a modular engine whose companion packages supply materials, file loaders, and GUI components.

### Does loading a model also enable simulated physics?

three.js physics integrations synchronize meshes with a separate physics world. Babylon.js uses external physics engines through plugins. PlayCanvas physics is powered by ammo.js.

### Why does a compressed glTF model need another decoder?

three.js GLTFLoader requires a DRACOLoader for Draco-compressed mesh assets.

### Can PlayCanvas run without its Editor?

The PlayCanvas engine runs directly in a standalone application, without the Editor.

### Why are PlayCanvas objects not casting shadows?

PlayCanvas lights start with shadow casting disabled until code enables it.

### How does CesiumJS position a locally authored model?

A model's modelMatrix transforms its local coordinates into Earth's Cartesian world frame.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best JavaScript 3D libraries three.js Babylon.js PlayCanvas Cesium code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
