mujoco-react 12.2.1 → 12.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/{chunk-OIMH4U5U.js → chunk-FVSVETBC.js} +8 -3
- package/dist/{chunk-OIMH4U5U.js.map → chunk-FVSVETBC.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +467 -214
- package/dist/index.js.map +1 -1
- package/dist/onnx.d.ts +1 -1
- package/dist/spark.d.ts +1 -1
- package/dist/spark.js +1 -1
- package/dist/{types-CF-BZXtW.d.ts → types-1ONW9gUW.d.ts} +10 -1
- package/package.json +2 -2
- package/src/components/SceneRenderer.tsx +38 -16
- package/src/index.ts +1 -0
- package/src/rendering/GeomBuilder.ts +34 -14
- package/src/rendering/cameraFrameCapture.ts +9 -3
- package/src/rendering/mujocoClassicMaterial.ts +203 -0
- package/src/types.ts +7 -0
package/README.md
CHANGED
|
@@ -318,6 +318,30 @@ reference objects and aligned RGB/depth previews.
|
|
|
318
318
|
See [camera capture docs](docs/hooks/use-camera-frame-capture.mdx#metric-rgb-d-capture)
|
|
319
319
|
for projection metadata, moving-camera sessions, and coordinate conventions.
|
|
320
320
|
|
|
321
|
+
### Native classic appearance
|
|
322
|
+
|
|
323
|
+
For comparisons with MuJoCo's classic OpenGL renderer, opt in per canvas:
|
|
324
|
+
|
|
325
|
+
```tsx
|
|
326
|
+
<MujocoCanvas config={config} renderOptions={{ appearance: "mujoco-classic" }}>
|
|
327
|
+
<Robot />
|
|
328
|
+
</MujocoCanvas>
|
|
329
|
+
// Capture the native display-code bytes without an additional sRGB transfer:
|
|
330
|
+
const frame = api.captureCameraRGBD({
|
|
331
|
+
cameraName: "agentview", rgbColorSpace: "linear-srgb",
|
|
332
|
+
});
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
This profile reads MJCF material emission, specular and shininess, compiled
|
|
336
|
+
texture color spaces, mesh normals, model lights and the camera headlight.
|
|
337
|
+
Three.js lights do not affect it. The standard appearance and sRGB RGB-D output
|
|
338
|
+
remain the defaults. `frame.rgbColorSpace` records the selected readback.
|
|
339
|
+
|
|
340
|
+
The classic profile currently supports finite planes, 2D/cube RGB textures and
|
|
341
|
+
up to eight spot/directional lights including the headlight. It excludes shadows,
|
|
342
|
+
planar reflections and mesh normal smoothing. It approximates the classic
|
|
343
|
+
renderer; camera image agreement does not establish physics or policy score parity.
|
|
344
|
+
|
|
321
345
|
## WebSocket Control
|
|
322
346
|
|
|
323
347
|
Stream actuator commands over a WebSocket and send simulation state back. Use a schema validator such as Zod at this boundary because socket messages are untrusted app input (`npm install zod` for this example):
|
|
@@ -731,6 +731,10 @@ function createCameraFrameCaptureSession(renderer, scene, fallbackCamera, option
|
|
|
731
731
|
target.depthTexture = new THREE2.DepthTexture(width, height, THREE2.UnsignedIntType);
|
|
732
732
|
depthReader = createMetricDepthReader(width, height, target.depthTexture);
|
|
733
733
|
}
|
|
734
|
+
const rgbColorSpace = nextOptions.rgbColorSpace ?? options.rgbColorSpace ?? "srgb";
|
|
735
|
+
if (rgbColorSpace !== "srgb" && rgbColorSpace !== "linear-srgb") {
|
|
736
|
+
throw new Error("RGB-D capture requires srgb or linear-srgb RGB bytes");
|
|
737
|
+
}
|
|
734
738
|
const rgb = new Uint8Array(width * height * 3);
|
|
735
739
|
let depth;
|
|
736
740
|
renderCaptureToTarget(captureOptions, () => {
|
|
@@ -741,7 +745,7 @@ function createCameraFrameCaptureSession(renderer, scene, fallbackCamera, option
|
|
|
741
745
|
const src = ((height - y - 1) * width + sx) * 4;
|
|
742
746
|
const dst = (y * width + x) * 3;
|
|
743
747
|
for (let c = 0; c < 3; c++) {
|
|
744
|
-
rgb[dst + c] = linearByteToSrgbByte(pixels[src + c]);
|
|
748
|
+
rgb[dst + c] = rgbColorSpace === "srgb" ? linearByteToSrgbByte(pixels[src + c]) : pixels[src + c];
|
|
745
749
|
}
|
|
746
750
|
}
|
|
747
751
|
}
|
|
@@ -749,6 +753,7 @@ function createCameraFrameCaptureSession(renderer, scene, fallbackCamera, option
|
|
|
749
753
|
});
|
|
750
754
|
return {
|
|
751
755
|
rgb,
|
|
756
|
+
rgbColorSpace,
|
|
752
757
|
depth,
|
|
753
758
|
width,
|
|
754
759
|
height,
|
|
@@ -1576,5 +1581,5 @@ function clamp01(value) {
|
|
|
1576
1581
|
*/
|
|
1577
1582
|
|
|
1578
1583
|
export { CAMERA_FRAME_CAPTURE_PRE_RENDER_USER_DATA_KEY, CAMERA_FRAME_CAPTURE_RENDER_USER_DATA_KEY, CAPTURE_EXCLUDE_KEY, ModelActuators, ModelBodies, ModelCameras, ModelGeoms, ModelJoints, ModelKeyframes, ModelResources, ModelSensors, ModelSites, ScenarioLighting, SplatEnvironment, SplatEnvironmentReadinessStatus, VisualScenarioEffects, captureCameraFrame, captureCameraFrameBlob, captureCameraFrameTensor, captureCameraRGBD, createCameraFrameCaptureSession, createCaptureCamera, createPairedSplatEnvironment, createSparkSplatViewerUrl, createSplatEnvironmentUserData, createSplatSceneConfig, createVisualScenarioExecutionContext, dataUrlToPolicyImageTensor, getContact, getScenarioBackground, getScenarioCameraPosition, getSplatEnvironmentReadiness, imageDataToPolicyImageTensor, pixelsToPolicyImageTensor, prepareCaptureCamera, registerModelResources, renderCameraFrameToCanvas, useSplatEnvironment, useSplatSceneConfig, useVisualScenarioEffects, useVisualScenarioExecutionContext, withContacts, withSplatEnvironment };
|
|
1579
|
-
//# sourceMappingURL=chunk-
|
|
1580
|
-
//# sourceMappingURL=chunk-
|
|
1584
|
+
//# sourceMappingURL=chunk-FVSVETBC.js.map
|
|
1585
|
+
//# sourceMappingURL=chunk-FVSVETBC.js.map
|