Synthetic Environment Module for IWER
npm install @iwer/sem
@iwer/sem (Synthetic Environment Module) is an extension for the Immersive Web Emulation Runtime (IWER). It enables advanced Mixed Reality features in IWER by emulating real-world environments with high-fidelity, including video passthrough, plane and mesh detection, semantic labels, and hit testing.
- Video Passthrough Emulation: Injects a video passthrough layer, rendering the captured scene behind the emulated app canvas.
- Plane & Mesh Detection: Provides XRPlane and XRMesh information via the plane-detection and mesh-detection APIs in IWER.
- High Fidelity Scene Mesh: Supports emulation of high-fidelity scene meshes exposed on Meta Quest 3 and 3S devices.
- Hit-Test: Enables hit-test APIs through IWER by conducting real-time raycasting spatial queries with the loaded environment.
@iwer/sem is currently in 0.x status and is under active development. This is an early build, changes may occur before the official v1.0 release.
To install @iwer/sem, use the following npm command:
``bash`
npm install @iwer/sem
@iwer/sem requires an active IWER runtime. If you are new to IWER, refer to the IWER Getting Started Guide. Here is a quick example:
`javascript
import { XRDevice, metaQuest3 } from 'iwer';
// Initialize the XR device with a preset configuration (e.g., Meta Quest 3)
const xrDevice = new XRDevice(metaQuest3);
// Install the IWER runtime to enable WebXR emulation
xrDevice.installRuntime();
`
Integrate @iwer/sem:
`javascript
import { SyntheticEnvironmentModule } from '@iwer/sem';
const sem = new SyntheticEnvironmentModule();
xrDevice.installSyntheticEnvironmentModule(sem);
`
Load an environment using a JSON object:
`javascript`
sem.loadEnvironment(sceneJSON);
Or fetch from an external source:
`javascript`
const url = 'path/to/your/scene.json';
fetch(url)
.then((response) => response.json())
.then((data) => {
sem.loadEnvironment(data);
})
.catch((error) => {
console.error('Error loading JSON:', error);
});
@iwer/sem` is licensed under the MIT License. For more details, see the LICENSE file in this repository.
Your contributions are welcome! Please feel free to submit issues and pull requests. Before contributing, make sure to review our Contributing Guidelines and Code of Conduct.