@menloresearch/aperture
v0.2.0
Published
MuJoCo scene graph renderer for Three.js (createAperture API)
Readme
@menloresearch/aperture
Plain JavaScript MuJoCo scene-graph renderer for Three.js.
Install
npm install @menloresearch/aperture threeAPI
import * as THREE from 'three';
import { createAperture } from '@menloresearch/aperture';
const scene = new THREE.Scene();
const aperture = createAperture({
engine: 'mujoco', // optional, defaults to 'mujoco'; plugin objects are also supported
scene,
renderer, // optional THREE.WebGLRenderer, enables shadow config
debug: { level: 'info', sampleIntervalMs: 2000 },
lighting: {
enableShadows: true,
shadowMapSize: 1024,
useHeadlightAmbient: true,
headlightAmbientScale: 1.6,
useRoomDirectionalFill: true,
roomDirectionalScale: 1.6,
},
effects: { groundReflection: false, reflectionTextureSize: 1024 },
filters: { showCollisionGeoms: false, collisionGroups: [3, 4] },
});
aperture.init(sceneInitPayload);
aperture.step(framePayload);
const stats = aperture.getStats();
aperture.dispose();Methods
init(sceneInit)builds the static scene graph.step(frame)applies body/light transforms.reset(sceneInit)rebuilds from a new init payload.getStats()returns warning count, frame/drop estimates, and summaries.getStats()also returns material and light summaries.onWarning(callback)subscribes to validator/protocol warnings.dispose()releases resources.
Message Contract
See docs/protocol.md for the Phase 0 contract.
Protobuf draft scaffold lives in src/proto/.
Local examples
- Basic local fixture replay:
examples/basic/ - Live WebSocket stream (Phase 2):
examples/live/ - Live WebSocket stream:
examples/live-websocket/
Sample payloads
- Scene/frame sample payloads live in
src/tests/samples/.
Publishing
This package is configured to publish only minified files from dist/.
npm publish --access public