-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Description
Description
Since r152 the renderer.autoClear flag is effectively ignored when in an XR session. This seems to be a result of changes made as part of #25781. The code in WebGLBackground now force clears if there is an XR session.
Relevant code: https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLBackground.js#L47-L66
(note that the switch case is exhaustive as per WebXR spec, and all cases set forceClear)
This causes a problem when the frame is rendered using multiple renderer.render() calls. Setting renderer.autoClear = false no longer suffices in that case. It can be worked around by setting the individual autoClearColor, autoClearDepth and autoClearStencil, as these are still honoured, but I believe the behaviour differing between non-XR and XR is a bug (or at least not intuitive).
Reproduction steps
- Disable
autoClear - Render a frame with more than one
render()call (e.g.clear(),render(object1),render(object2)) - Start an XR session and see only the result of the last
render()call
Code
renderer.autoClear = false;
renderer.clear();
renderer.render(object1, camera);
renderer.render(object2, camera);Live example
Example: https://jsfiddle.net/br1nygdk/2/
The example shows two spheres; one cyan and one magenta. When clicking 'Enter VR' only the magenta sphere is visible, whereas both should be visible. Setting autoClearColor to false works around the issue.
(Note: it's not possible to enter VR in the fiddle on a Quest, but the immersive-web-emulator can be used as well)
Screenshots
No response
Version
r152
Device
Headset
Browser
Chrome
OS
Android