Environment depth on macOS
Effects that read Meta's environment depth (occlusion, depth-lit surfaces, anything sampling
_EnvironmentDepthTexture) draw nothing in a Unity app on a Mac, even though PuppetXR simulates
the depth sensor (XR_META_environment_depth). Two pieces of Meta's Unity stack stop it:
- Meta's
EnvironmentDepthManagercompiles its OpenXR depth provider only for Android and the Editor, so a macOS player reports depth as unsupported ("EnvironmentDepth is disabled"). - In the Editor, Unity's Meta occlusion plugin rejects Metal ("[SwapchainImageCollection] Unsupported Graphics API: 16").
The optional Geppetto Depth Bridge (macOS) OpenXR feature fills that gap for development builds on
PuppetXR. It reads XR_META_environment_depth from the runtime itself and sets the shader globals
Meta's EnvironmentDepthManager sets on a headset:
| Global | Value |
|---|---|
_EnvironmentDepthTexture |
The latest depth image, one layer per eye, copied into a texture each frame |
_EnvironmentDepthReprojectionMatrices |
Clip space of each depth view from world space |
_EnvironmentDepthZBufferParams |
Normalized device depth to linear depth: x / (ndc + y) |
Shaders written against Meta's environment depth inputs work unchanged.
Turn it on
- In Project Settings > XR Plug-in Management > OpenXR, on the Standalone tab, enable Geppetto Depth Bridge (macOS).
- Make a Development Build for macOS and run it on PuppetXR. (Play mode in the Editor runs the bridge too, but is not validated yet; see Limits.)
The Editor or player log says [Geppetto] Depth bridge: environment depth from the OpenXR runtime,
<width>x<height> per view., and then reports the copies it has made.
The bridge does nothing outside the Editor and development players, off macOS, or off Metal. A non-development build with the feature enabled fails with "The Geppetto Depth Bridge is development-only", like Geppetto App Tools. Keep Meta's own occlusion features (Meta Quest: Occlusion) for Android; they do not apply on a Mac.
Limits
- The depth comes from PuppetXR's simulated sensor (its rate, latency, noise and coverage; see
PuppetXR's
docs/config.md, Environment depth), not from a headset. - World space is the main camera's parent (the rig's tracking space), as with Meta's camera rig. Apps that move the tracking space elsewhere need that transform to match.
- Hands are not removed from depth, and Meta's
EnvironmentDepthManagerfeatures beyond the globals (masks, hand removal,IsDepthAvailable) are not provided. - Checked on PuppetXR in a macOS development player; the Editor path is not yet validated.
- If a runtime's depth rows run the other way,
GEPPETTO_DEPTH_BRIDGE_FLIP_Y=1flips them.