nanoraster
v0.9.0
Published
Tiny headless WebGPU glTF renderer for deterministic PNG, WebP, JPEG, and raw RGBA output.
Maintainers
Readme
Tiny headless WebGPU glTF renderer for deterministic PNG, WebP, JPEG, and raw RGBA output. One Rust core runs native in Node.js and on WebGPU in the browser.
Try the live demo, then the docs — served as Markdown for agents at nanoraster.xyz/llms.txt.
Install
npm install nanorasterQuick start
import { renderImage } from 'nanoraster';
import { readFile, writeFile } from 'node:fs/promises';
const glb = Uint8Array.from(await readFile('model.glb'));
const image = await renderImage(glb, {
format: 'webp',
width: 512,
height: 512,
});
await writeFile(image.name, image.bytes);Same request, same pixels: a render can serve as evidence. format: 'raw'
returns the RGBA frame for pixel diffs, video frames and textures
(Work with raw pixels).
Spatial values are Cartesian, defaulting to glTF's +Y-up, +Z-forward, metre
world; declare world when the caller uses another convention:
const image = await renderImage(glb, {
format: 'webp',
world: { up: '+z', forward: '-y', unit: 'millimeter' },
camera: {
framing: 'fit',
direction: [1, 1, 1],
},
lineWidth: 3,
});framing: 'fit' solves placement and clipping around the subject;
framing: 'fixed' preserves an explicit Cartesian position/target/up
pose and projection. Edge lines are a flat 3 output pixels. See
Frame the model and
Place the camera.
Reuse the renderer
One-shot calls share one renderer per process; create your own to control
lifetime and power preference. Declaring all outputs in one renderImages
call with per-view overrides is about three times faster:
import { createRenderer } from 'nanoraster';
using renderer = await createRenderer({ powerPreference: 'low-power' });
const [card, og] = await renderer.renderImages(glb, {
format: 'webp',
views: [
{ id: 'card', width: 768, height: 576 },
{ id: 'og', width: 1536, height: 804, format: 'png' },
],
});See Reuse the renderer.
Compatibility
See compatibility.md; every check mark maps to a named job
in .github/workflows/ci.yml.
Versioning and stability
Semantic Versioning; before 1.0 a minor release may break the API — see BREAKING_CHANGES.md.
Security and provenance
Report vulnerabilities through GitHub private vulnerability reporting. Verify
registry signatures with npm audit signatures.
Links
Changelog · Issues · Contributing · Maintaining
License
Apache-2.0. See license and NOTICE for bundled materials.
Part of the Tau ecosystem.

