Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Oroboros's avatar
Oroboros
Honored Guest
9 years ago

SetStereoProjectionMatrix doubles shadow caster count


In Unity, when I use the method SetStereoProjectionMatrix on an single Oculus VR Camera, I immediately lose all shadow caster optimizations until I call ResetStereoProjectionMatrices again. Even if I simply set the stereoprojectionmatrix to itself, my shadow caster count immediately doubles:

GetComponent<Camera> ().SetStereoProjectionMatrix(Camera.StereoscopicEye.Left, GetComponent<Camera> ().GetStereoProjectionMatrix(Camera.StereoscopicEye.Left));

Is there a way to set the stereoprojectionmatrix of the camera, without losing first-party optimizations? I'm trying to create a working VR temporal AA effect, and this is the last piece of the puzzle.

Note: I am on Unity 5.5f2

2 Replies

Replies have been turned off for this discussion
  • Oroboros's avatar
    Oroboros
    Honored Guest


    Hi,

    Welcome the Oculus Forums.

    Is there a way to set the stereoprojectionmatrix of the camera, without losing first-party optimizations?
    No, this is how Unity behaves. By default, it uses an optimized stereo projection that is also perceptually valid for the VR headset. Setting it to anything else would be problematic. 



    Hi imperativity and thanks for responding.

    Is there any way to get this "optimized" stereo projection matrix? Can I somehow get this in code? Or is this completely cut off from api access? If not, is there a way for me to simulate the optimizations in of the projection matrix, such as decreased verts/tris or not having to double shadow counts? I really want to release my temporal AA solution to the community.
  • Oroboros's avatar
    Oroboros
    Honored Guest
    I'm trying to create an effect where I halton shake the left and right eye, and put it back together into a non jittered image. Is this simply not possible while trying to keep optimizations? Does this mean simply doing a screen shake (https://docs.unity3d.com/ScriptReference/Camera-projectionMatrix.html) in VR will remove optimizations, and theres no way to get around that? If this is the case, then this seems extremely limiting...