WebGLBackground: renderer.autoClear
has no effect when an XR session is active
#25955
Labels
Milestone
renderer.autoClear
has no effect when an XR session is active
#25955
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 inWebGLBackground
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. Settingrenderer.autoClear = false
no longer suffices in that case. It can be worked around by setting the individualautoClearColor
,autoClearDepth
andautoClearStencil
, 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
autoClear
render()
call (e.g.clear()
,render(object1)
,render(object2)
)render()
callCode
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
The text was updated successfully, but these errors were encountered: