Commit 47742e8
fix(environment): compensate IBL rotation on XR recenter
Summary:
### Core fix: `environment-system.ts`
When a user recenters in XR (e.g., long-pressing the Oculus button), the reference space resets with a new origin/orientation. Previously, `environmentRotation` and `backgroundRotation` were not adjusted, causing the IBL lighting and skybox to visually shift relative to the real world.
The fix:
- Listens for `sessionstart`/`sessionend` on `xrManager` to track XR lifecycle
- Attaches a `reset` listener on the XR reference space (with deferred attachment via `needsResetListener` flag in the update loop if the ref space isn't available at session start)
- Extracts the yaw component from the reset event's quaternion transform
- Accumulates a `recenterYawOffset` that's applied to the Y rotation of both `scene.environmentRotation` (IBL) and `scene.backgroundRotation` (skybox) in `updateBackgroundProps`, `updateIBLProps`, and the immediate `applyRecenterCompensation` path
- Cleans up all listeners on session end and system disposal
### Test fixture: `scene-understanding` example
- Added a Venice sunset EXR texture to the asset manifest and `public/textures/`
- Added `IBLTexture` and `DomeTexture` components to the level root so the scene-understanding example has a directional HDR environment for visually verifying the recenter fix
Reviewed By: zjm-meta
Differential Revision: D94147476
fbshipit-source-id: 6ddf2d5f15aa9d83a11a8b28b4aa74ec1ca03f0f1 parent 8df424d commit 47742e8
File tree
3 files changed
+112
-3
lines changed- examples/scene-understanding
- public/textures
- src
- packages/core/src/environment
3 files changed
+112
-3
lines changedBinary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
93 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
94 | 103 | | |
95 | 104 | | |
96 | 105 | | |
| |||
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
114 | 127 | | |
115 | 128 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
80 | 83 | | |
81 | 84 | | |
82 | 85 | | |
| |||
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
96 | 109 | | |
97 | 110 | | |
98 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
99 | 121 | | |
100 | 122 | | |
101 | 123 | | |
| |||
199 | 221 | | |
200 | 222 | | |
201 | 223 | | |
202 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
203 | 229 | | |
204 | 230 | | |
205 | 231 | | |
| |||
295 | 321 | | |
296 | 322 | | |
297 | 323 | | |
298 | | - | |
| 324 | + | |
299 | 325 | | |
300 | 326 | | |
301 | 327 | | |
| |||
359 | 385 | | |
360 | 386 | | |
361 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
362 | 458 | | |
363 | 459 | | |
364 | 460 | | |
| |||
0 commit comments