Exapedia / Tools / JavaScript 3D libraries JavaScript 3D libraries Updated Nov 2026
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 three.js React Three Fiber regl ogl @splinetool/runtime CesiumJS Babylon.js PlayCanvas FAQ Popularity three.js has the most monthly downloads in this comparison, at 133.8M .
Library Monthly downloads Stars Last release License three.js 133.8M
118.6K Oct 2026 MIT React Three Fiber 35.7M
33.8K Oct 2026 MIT regl 5.1M
5.6K Nov 2024 MIT ogl 4.4M
4.8K Jan 2025 Unlicense @splinetool/runtime 3.0M
Not on GitHub Nov 2026 Not declared CesiumJS 1.7M
16.0K Nov 2026 Apache-2.0 Babylon.js 1.6M
26.4K Nov 2026 Apache-2.0 PlayCanvas 712.8K
17.3K Nov 2026 MIT Downloads: npm , last thirty days. Stars and releases: GitHub. Amber: no release in over a year.
Libraries and code examples 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 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. Limitations 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. $ npm install three Copy
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 );
}
three.js examples From open-source projects on GitHub 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();
}
Show full example Renders three.js scenes from React components.
Downloads / mo 35.7M
Stars 33.8K
Last release 9.8.2
License MIT $ npm install three @react-three/fiber Copy
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>
);
}
React Three Fiber examples From open-source projects on GitHub 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,
}
}
Show full example 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 $ npm install regl Copy
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] });
regl examples From open-source projects on GitHub 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]},
]);
}
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 $ npm install ogl Copy
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 });
ogl examples From open-source projects on GitHub 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 }]} />
}
Show full example 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 From open-source projects on GitHub
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);
}
Show full example 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 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. Limitations 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. $ npm install cesium Copy
import { Viewer } from "cesium";
import "cesium/Build/Cesium/Widgets/widgets.css";
const viewer = new Viewer("cesiumContainer");
CesiumJS examples From open-source projects on GitHub 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();
}
Show full example 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 $ npm install @babylonjs/core Copy
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();
});
Babylon.js examples From open-source projects on GitHub 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;
}
Show full example 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 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. Limitations 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. $ npm install playcanvas Copy
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();
PlayCanvas examples From open-source projects on GitHub 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());
}
}
Show full example For coding agents
Found your 3D library? Help your agent use it. Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.
Claude Code Cursor Codex VS Code Devin Devin Desktop Gemini CLI OpenCode
Run in your terminal
claude plugin install exa@claude-plugins-official Copy Add to ~/.cursor/mcp.json
{
"mcpServers": {
"exa": {
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy Open in your browser, then install the Exa plugin
https://chatgpt.com/plugins/exa Copy Add to .vscode/mcp.json
{
"servers": {
"exa": {
"type": "http",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy In Devin, open Customize, then MCPs, and add a custom HTTP server with this URL
https://mcp.exa.ai/mcp Copy Add to ~/.config/devin/mcp_config.json
{
"mcpServers": {
"exa": {
"serverUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to ~/.gemini/settings.json
{
"mcpServers": {
"exa": {
"httpUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to opencode.json
{
"mcp": {
"exa": {
"type": "remote",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy