Match the room's light and depth in AR
Updated
An XR World with XR Light Estimate and XR Depth Occlusion: in AR the scene is lit like the real room and real things hide virtual ones. Buttons switch between a fast mode and high realism, with shadows from the real main light and soft occlusion.
This one needs AR: enter AR on an Android phone or a Quest 3 and press High realism. On a desktop there is no estimate or depth, so the stage lights stay in charge and the buttons only change the settings.
Match the room's light and depth in AR
#pragma lifecycle(startup)
function apply(high, light, occlusion) { light.setProps({ castShadow: high }); occlusion.setProps({ softness: high ? 0.05 : 0, depthBias: 0.02 }); log(high ? 'High realism: real light casts shadows, soft occlusion' : 'Fast mode');}
function startup() { const world = findEntity('XR World'); const light = world.getComponent(XRLightEstimateComponent); const occlusion = world.getComponent(XRDepthOcclusionComponent); log('Occlusion up to', occlusion.props.maxDistance, 'm. Estimates arrive only in an AR session.');
on('quality/fast', (event) => { if (event.eventType === EventType.UIButton.Press) apply(false, light, occlusion); }); on('quality/high', (event) => { if (event.eventType === EventType.UIButton.Press) apply(true, light, occlusion); });}Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
XrRealism.xrproj