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 ?]