disabling stereo rendering for a camera

Hello !

I would like to disable the stereo rendering for one camera in my scene. I use a camera which render a few objects to make them appear very far and very big from the user (when they are just next to the user and tiny in the scene). It is the same principle as the Skybox3D if you know Source Engine (

)…

I’ll call the camera “SkyboxCamera”

So far, I disabled the tracking of the SkyboxCamera by the HMD using this :
VRDevice.DisableAutoVRCameraTracking(SkyboxCamera, true);
And I copy the rotation quaternion from my tracked camera into the skybox camera.
This way, every object which is rendered by the skybox camera move as the user move his head.

The problem is that rendered objects feel very tiny in 3D. They are actually, less than 1 unit.

But by removing the stereo from the SkyboxCamera, I will get the wanted effect.

To remove the stereo on my SkyboxCamera, I would like to set the StereoSeparation at 0. That way, each eye will see the same thing and no 3D effect (plus only one rendering instead of two)

This is where I’m stuck. Stereo Separation attribute on the camera inspector doesn’t work since the value is given by the vr device.

So I though I would use this, inspired by this : Unity - Scripting API: Camera.SetStereoViewMatrix

Matrix4x4 viewL = SkyboxCamera.worldToCameraMatrix;
Matrix4x4 viewR = SkyboxCamera.worldToCameraMatrix;

viewL[12] = 0f;
viewR[12] = 0f;
SkyboxCamera.SetStereoViewMatrix(Camera.StereoscopicEye.Left, viewL);
SkyboxCamera.SetStereoViewMatrix(Camera.StereoscopicEye.Right, viewR);

In a way, it is working because there is no more 3d effect on my SkyboxCamera but it doesn’t follow my mainCamera rotation anymore.

I don’t know why it isn’t working. If someone who knows the graphical pipeline with all the matrix transformation can give me a hint…

Thanks for reading !

[this thread is a doublon of this one : https://forum.unity.com/threads/disable-stereo-3d-from-a-camera.508506/ I think I can get more answers in scripting section… If admin can delete the initial thread ?]

1 Like

bump short answer.
The more the scale is close to 0, the less the effect of 3D.
So a camera set in stereo rendering with a uniform scale value of 0.001 has no 3D effect.

Hey, I am facing the same problem here. Could you try to give some more information on your solution? Thank you!

This removes 3d effect from camera →

Camera m_Camera;
m_Camera.transform.localScale = Vector3.zero;

1 Like

Thanks for the help. I actually had the same problem and your solution worked for me. But can you please explain why setting local scaling of camera eliminates the stereopsis? I am so happy that the camera works the way I want but not knowing the reason bothers me a bit. Thanks a lot.

I have no idea why :confused: