Is there any way to shrink(narrow) the camera view?

Hey there!
I’m working on the feature with “Side-by-side” view for 3d monitors and I almost done with it but I also need to shrink the camera view. I attached a screenshot of what I need to do exactly. Is it possible to do it in the same way and in the same time fitting it in the browser window?

Also need to mention that I’m using multiple viewports feature.
Thanks in advance!

Hello and welcome!!
You can change the camera fov if this is what you mean?

Uhm not really… I need to squeeze the camera view horizontally or adjust it vertically without affecting the fov.

can the camera viewport be a solution?

I’m already using the viewports, but the problem is when I’m trying to stretch the viewport by the y parameter it’s just making my fov smaller. How can I fit it in window?

Hello just checking in, was your question answered? @noone

Hello! Even though this topic is long dead, I was not able to find the solution to this side by side shrinking issue.

In this playground, I render the scene twice from the point of view of each eye.

Now on certain screens, the final 3D image will appear strech horizontally because each view only occupies half the viewport in the initial config.

Compressing horizontally the left and right images would compensate that effect and create the desired result. Is there anyway to do that in Babylon without tampering the projection matrix? The current viewport approach is a bit limited.

Here is a before/after view of what I am trying to achieve drawn on paint ^^

Before:

After:

Okay I found something!

Basically I can attach the eye cameras to a transform and then scale this transform on its local x axis, which will be then applied to the child cameras :ok_hand:

That’s quite a dirty hack, I am still looking for a better solution if it exists.

Also I was wondering if the StereoscopicFreeCamera is still actively maintained. If that’s the case I could open a PR to add this stretching feature :thinking:

Sorry I am off for a week maybe @Evgeni_Popov can help as he already worked on the screenshot code ?

Is there a problem with the screenshot code?

@CrashMaster You can also use the Camera.onProjectionMatrixChangedObservable observable to change the projection matrix by calling Matrix.PerspectiveLH and set the width/height of the viewport used by the projection code:

Oh that’s much better thank you!

I still had to set the width to 2 when using the scene fullscreen like this:

And it even fixes Gaussian splatting looks bad on custom viewports

As a side note, PerspectiveFovLH must be used when the FOV is changed: