A 3D engine for the web that starts at 20 KB.

A Rust and Wasm kernel with WebGPU rendering, a WebGL2 fallback, and optional packs you load only when needed.

Get started Open the live demo

Night Citadel, a procedural castle under a moon, rendered live by Margo Engine

Five lines to a rendered scene

The margoengine facade mounts a canvas, enables orbit controls and starts rendering.

import {createStage} from 'margoengine';
const app = await createStage('#scene');
const orb = app.sphere({color: '#84d6bd', roughness: 0.25});
app.onTick(delta => {orb.rotation.z += delta;});
window.addEventListener('pagehide', () => app.dispose(), {once: true});

Run it from source today

git clone https://github.com/scottcampbelldata/margoengine.git margoengine
cd margoengine
npm ci
npm run dev

Needs Node.js 22.12 or newer. The Wasm kernel is checked in, so no Rust toolchain is required.

What is on npm right now

The Margo release includes 60 packages under @margoengine and the margoengine stage facade. npm publication is pending. Once published, install the core in your app:

npm install @margoengine/core

Browse all packages, npm availability and runnable examples

What the core gives you

About 20 KB gzip
Core plus the stage facade, embedded Wasm and both backends included. CI rejects any build at 20,000 bytes gzip or above.
Transforms in Wasm memory
Hierarchy, culling and world matrices run in a Rust kernel over flat typed arrays, up to 100,000 entities per engine.
Instancing by default
Meshes that share a geometry are drawn in one instanced call, even when their materials differ.
WebGPU first, WebGL2 fallback
Reversed float depth, GPU picking and automatic device-loss recovery on WebGPU. Basic scenes still render on WebGL2.
Plugins, not a monolith
Frame-graph passes and shader hooks let optional packs add features without growing the base bundle.

Optional packs

Each pack is a separate, tree-shakable package. Your app loads only the ones it imports.

Assets

gltf and gltf-pro for static and textured glTF, blender for prepacked .margo exports, plus loaders for STL, OBJ, PLY, 3MF, USDZ and IFC.

Rendering

environment for HDR image-based lighting, shadows, clustered lights, post for SSAO, taa, tonemap and lines.

Interaction

controls for orbit, fly and transform gizmos, selection for outlines and picking, and react for ordinary React 18 and 19 components.

Domains

machinery for joints, sections, dimensions and CAD import, creative and vfx for particles and post effects, scenery, terrain and splats.

See it running

Every demo below runs live in your browser. They need WebGPU, so use a current Chrome or Edge on desktop.

Browse the published packages and their runnable examples

Where it stands

Margo Engine is at version 0.1.0 and MIT licensed. WebGPU needs a supporting browser on HTTPS or localhost. Particles, sections, image-based lighting and the scenery pack require WebGPU; CPU-side machinery and CAD tools work on either backend. It has been verified in Chrome and Edge on desktop. Firefox, Safari and mobile GPUs are not yet verified.