Skip to content

Rendering: Fix stereo image separation bug

Fix how the final transformation, T, described in "Generalized Perspective Projection" is applied when doing off-axis projection. This transform encapsulates the viewpoint offset, and should be computed using the same eye positions used to compute the rest of the projection matrix, but was inadvertently computed using the single EyePosition.

The result of the bug was that stereo images of an object were always a fixed distance apart from each other, regardless of the objects location w.r.t. the screen, and regardless of the the eye position w.r.t. the object.

Bug was introduced (by me) in !9654 (merged).

This change moves computation of the left/right eye into GetEyePosition() and uses it from both the projection and view transform computations.

Also adds a test to render three disks at different locations with respect to the screen, and make sure the stereo image pairs behave correctly. If stereo rendering is working correctly, a disk that is coincident with the screen should have left/right images rendered directly on top of one another. Likewise, a disk in front of the screen and a disk in back of the screen should have the stereo image pairs reversed compared to one another.

The new test/baseline demonstrates that this is working:

TestStereoEyeSeparation

Edited by Scott Wittenburg

Merge request reports