Forum Discussion
blascoburguillos
4 years agoExplorer
stereoEnabled = false, GetStereoProjectionMatrix always identity in Unity 2021.2.11f1 Oculus
I'm using Oculus integration installed with the XR-plugin manager with Unity 2021.2.11f1
The camera.stereoEnabled seems to always bee false, although GetStereoProjectionMatrix is true. Also GetStereoProjectionMatrix and GetStereoViewMatrix return always the identity matrix:
if (renderingData.cameraData.xrRendering) {
/* if (camera.stereoEnabled) { */ // Always false
Debug.Log("Stereo enabled!");
var projLeft = camera.GetStereoProjectionMatrix(Camera.StereoscopicEye.Left); // Always identity
var viewLeft = camera.GetStereoViewMatrix(Camera.StereoscopicEye.Left); // Always identity
viewProjLeft = projLeft * viewLeft;
Debug.Log($"viewLeft: {viewLeft}");
Debug.Log($"projLeft: {projLeft}");
Debug.Log($"viewProjLeft: {viewProjLeft}");Any idea what could be going wrong? Is this a bug or should I be getting those matrices from somewhere else?
Here an easy copy and paste script that can be attached to the camera to reproduce:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraTest : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
var camera = GetComponent<Camera>();
var stereoEnabled = camera.stereoEnabled;
Debug.Log($"Stereo enabled: {stereoEnabled}");
var projLeft = camera.GetStereoProjectionMatrix(Camera.StereoscopicEye.Left); // Always identity
Debug.Log($"projLeft: {projLeft}");
var viewLeft = camera.GetStereoViewMatrix(Camera.StereoscopicEye.Left); // Always identity
Debug.Log($"viewLeft: {viewLeft}");
}
}
2 Replies
Replies have been turned off for this discussion
- blascoburguillosExplorer
It seems that on a clean project GetStereoProjectionMatrix and GetStereoViewMatrix are working fine. stereoEnabled is false always though. In a clean 2019 project it works fine, so it might be a bug. I´m trying to figure out what could break GetStereoProjectionMatrix and GetStereoViewMatrix in my main project... If anybody has a clue what could affect this, please let me know.
- blascoburguillosExplorer
I noticed that it works in a clean project. It stops working if the skybox material is null. I was about to report this update:
Setting that to null breaks GetStereoProjectionMatrix and GetStereoViewMatrix .Could you test this with your setup too? I tested with unity 2020 and 2021
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago