Skip to content
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

Potentially incorrect camera position used for directional light culling and shadow rendering in XR session #3634

Open
potentially-null opened this issue Oct 28, 2021 · 3 comments
Labels
area: graphics Graphics related issue area: xr XR related issue bug

Comments

@potentially-null
Copy link

Description

If a script modifies the camera's local position while the camera is driven by the XR system during an active XR session and the scene contains a real-time directional light with cast shadows enabled, the position used when performing directional light culling and directional light shadow rendering is the one set by the script rather than the one computed by the XR system. As a result, directional light shadow mapping might break.

Expected

The XR system forces the camera's local position to the XR viewer position before rendering as described here.
The resulting position is subsequently used when performing directional light culling and directional light shadow rendering regardless of whether a script modifies the camera's local position.

@yaustar yaustar added area: graphics Graphics related issue area: xr XR related issue bug labels Oct 28, 2021
@yaustar
Copy link
Contributor

yaustar commented Oct 28, 2021

Would it be possible to share an example project that shows the breakage please?

@potentially-null
Copy link
Author

example project

I have forked your dinosaur example and added a script to the root which logs the camera position to the console at key points during the frame.
Notice that the shadow of the directional light is not being displayed as a result of the camera position set in update().

@mvaligursky
Copy link
Contributor

related: #3635 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue area: xr XR related issue bug
Projects
None yet
Development

No branches or pull requests

3 participants