Depth can move with you.
Study the official custom-depth bridge: a WebGL-only
ShaderMaterial samples a two-layer depth array, while
controller selectstart/selectend attaches and releases the same
objects that the shader shades.
Preparing WebGLRenderer, ShaderMaterial, depth-array fixture, and controller spaces...
- mode
- -
- controllers
- -
- selected
- -
- owned
- -
- depth
- -
- occlusion
- -
- ray hits
- -
- events
- -
- draws
- -
- frames
- -
Connect a virtual controller, aim at an object, then selectstart to attach it to the target-ray space.
The log records connection, hover, selectstart, move, selectend, and disconnect transitions.
ShaderMaterialcustom GLSL fragmentsampler2DArray depthColortwo XR viewshasDepthSensing()capability gategetDepthTexture()session depth inputcontroller.attach / group.attachdrag ownershipThe procedural array exercises the same shader uniform shape on desktop. Native depth texture dimensions and occlusion still come only from a compatible immersive XR session.
Desktop simulation verifies the shader, depth-array, and drag contracts; physical depth data, occlusion alignment, controller pose, and immersive timing require a headset.
This study intentionally uses WebGLRenderer because Three.js ShaderMaterial is WebGL-only. The XR button requests optional depth-sensing; desktop depth is explicitly procedural.