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

Stereoscopic cameras render the scene incorrectly #8000

Closed
RaananW opened this issue Apr 8, 2020 · 4 comments
Closed

Stereoscopic cameras render the scene incorrectly #8000

RaananW opened this issue Apr 8, 2020 · 4 comments
Assignees
Labels

Comments

@RaananW
Copy link
Member

RaananW commented Apr 8, 2020

When rendering the scene using a stereoscopic camera (side by side or over-under, the scene renders incorrectly.

The current behavior:

image

The expected behavior:

image

@RaananW RaananW added bug in progress Someone is currently working on this issue labels Apr 8, 2020
@RaananW RaananW self-assigned this Apr 8, 2020
@RaananW RaananW removed the in progress Someone is currently working on this issue label Apr 8, 2020
@RaananW RaananW closed this as completed Apr 9, 2020
@foxxyz
Copy link
Contributor

foxxyz commented Dec 2, 2020

Is it possible this change has broken the interlaced stereoscopic view (Camera.RIG_MODE_STEREOSCOPIC_INTERLACED) added in #7425? Looking at the changes in your commit in stereoscopicRigMode.ts, there are no more checks for Camera.RIG_MODE_STEREOSCOPIC_INTERLACED and setting this rig mode now seems to incorrectly add separate viewports and shows identical output to Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL.

Client workaround for vertical interlacing seems to be:

camera.setCameraRigMode(Camera.RIG_MODE_STEREOSCOPIC_INTERLACED, { interaxialDistance: 0.0637 })
camera._rigCameras[0]._rigPostProcess = new PassPostProcess(camera.name + '_passthru', 1.0, camera._rigCameras[0])
camera._rigCameras[0].viewport = new Viewport(0, 0, 1, 1)
camera._rigCameras[1]._rigPostProcess = new StereoscopicInterlacePostProcessI(camera.name + '_stereoInterlace', camera._rigCameras, false, true)
camera._rigCameras[1].viewport = new Viewport(0, 0, 1, 1)

But this seems like it should be patched back in as a post-processor in Camera._setStereoscopicRigMode()...

Let me know your thoughts.. Happy to submit a PR if needed. Thanks!

@RaananW
Copy link
Member Author

RaananW commented Dec 4, 2020

Hi @foxxyz - this is more than possible :-) We just want to be sure that the window ratio pre and post resizing stays correct.

If you want to open a new issue for this, or even submit a PR with a fix - please go right ahead. Make sure to reference this PR (and me if you want me to review it).

foxxyz added a commit to foxxyz/Babylon.js that referenced this issue Dec 6, 2020
@Hannes3112
Copy link

Hannes3112 commented May 6, 2021

Hi @RaananW
The Stereoscopic cameras are still rendering not correct because they are using the toe-in method rather than an Off-Axis projection. This introduces so called vertical disparities which are quite problematic as they are hurting the eyes and scenes becoming difficult to watch:

vert Disp

The correct method is called Off-Axis projection, which can be achieved via camera matrix manipulation (shifting the virtual sensor on its x-axis) or viewport cropping. I would be very happy to help with the mathematics / logic and with testing (but not with code, I'm not a programmer).

It would also be very nice if the isStereoscopicSideBySide property could be set to squeezed mode because almost all stereoscopic displays with SbS or TB input need it in Half (squeezed) mode, like this:

SbS-Half
So, the initial output was not wrong, it was just missing the option to set it to SbS/TB Full (which it is now).

@Hannes3112
Copy link

Here is a very comprehensive text about the topic:
http://paulbourke.net/stereographics/stereorender/

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

No branches or pull requests

3 participants