-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
Description
Description
Frustum culling for ArrayCameras was changed in #30830 for Renderer: a FrustumArray now culls for each camera independently.
For XR sessions with two views, XRManager and WebXRManager both use setProjectionFromUnion to compute a combined projection matrix for the XR ArrayCamera.
In WebGLRenderer, this is used for culling in the same way as any other camera.
In Renderer, the new FrustumArray takes over and each camera from the XR ArrayCamera is culled separately.
I think the inconsistency could be confusing, and the result of setProjectionFromUnion is now never used in the new renderer.
Solution
-
Backport the
FrustumArrayculling intoWebXRManagerto fix the consistency issue. -
If we want to keep the
setProjectionFromUnionbehaviour usable for frustum culling, we need to provide some way for (Web)XRManager to opt-out ofFrustumArrayculling when it only has two views.
This being opt-out rather than opt-in for XR would also fix the culling behaviour for XR devices with > 2 views, which currently don't cull properly in WebGLRenderer (but now do in Renderer, albeit per-view) - see #19387. (Full disclosure that I am working on something downstream which could make use of this).
See also: #15054 (comment) - we could also close that issue if we think that per-camera culling serves the same purpose as combining the frustra for now.
Alternatives
I think the consistency between the renderers is important, and the array camera behaviour is useful generally.
If there isn't appetite for the specific opt-out for the XRManagers, we could consider removing the setProjectionFromUnion path and just using the FrustumArray culling. I'm not sure what kind of performance difference it actually makes, given that - even without it - only one culling pass would probably be performed a not-insignificant amount of the time. Removing it could end up being cleaner.
N.B. that it seems like there's at least some userland usage of the combined projection matrix: #21002
Additional context
Some Background: