Skip to content

Commit 7aed708

Browse files
authored
fix(viewer): adjust IBL direction with useRightHandedSystem (#17026)
The viewer's IBL shadow-map direction was not properly adjusted when `useRightHandedSystem` is set to `true`. I added coordinate system handedness compensation in the `refreshLightPositionDirection`.
1 parent f3364bc commit 7aed708

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/tools/viewer/src/viewer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,11 @@ export class Viewer implements IDisposable {
19171917
},
19181918
refreshLightPositionDirection(reflectionRotation: number) {
19191919
let effectiveSourceDir = this.iblDirection.direction.normalizeToNew();
1920+
1921+
if (this.light.getScene().useRightHandedSystem) {
1922+
effectiveSourceDir.z *= -1;
1923+
}
1924+
19201925
const rotationYMatrix = Matrix.RotationY(reflectionRotation * -1);
19211926
effectiveSourceDir = Vector3.TransformCoordinates(effectiveSourceDir, rotationYMatrix);
19221927

0 commit comments

Comments
 (0)