Skip to content

WebXR fix frustum culling (right eye) #7411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main_v1
Choose a base branch
from

Conversation

Maksims
Copy link
Collaborator

@Maksims Maksims commented Mar 6, 2025

Fixes #5787

This PR changes the way view projection matrix is calculated when in stereo XR, by constructing average view matrix and offsetting it slightly backwards. This solves an issue where in right view (eye) objects were frustum culled too early (at the edge of right eye's frustum).

There is potentially a better way, by constructing a frustum that is based on left plane of left's frustum and right plane of right's frustum, but I'm not that smart to figure it out 😃

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

@willeastcott
Copy link
Contributor

I thought this was interesting:

https://computergraphics.stackexchange.com/a/8468

@Maksims
Copy link
Collaborator Author

Maksims commented Mar 16, 2025

I thought this was interesting:

https://computergraphics.stackexchange.com/a/8468

Perhaps a different method for culling (not frustrum) should be used in such edge cases. And that would be a separate PR.

@willeastcott
Copy link
Contributor

I think that over the 180 degree threshhold, you need to cull per eye. But below that, I think we simply need to have a Frustum#add or Frustum#merge function.

@Maksims
Copy link
Collaborator Author

Maksims commented Mar 16, 2025

I think that over the 180 degree threshhold, you need to cull per eye. But below that, I think we simply need to have a Frustum#add or Frustum#merge function.

As mentioned:

I'm not that smart to figure it out

Frustum#merge - would be great here, but bear in mind that this is not that simple, and in many cases, frustums are not mergeable.

For now, this PR improves a current situation, by removing culling issues on right eye on most XR devices I've tested. Future PR's can improve that. I believe that this issue been there for far too long, and decided to fix it within my mathematical abilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants