Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Stereo camera positions with shader

Discussion in 'AR/VR (XR) Discussion' started by rtbz, May 29, 2020.

  1. rtbz


    Jan 18, 2017
    I'm using the WebXRCameraSet plugin, which sets up a left and right camera. When I compile to WebGL, I'm able to load the scene into my Oculus HMD, but the same image is rendered for each eye.

    In the shader, I'm getting the camera position with:

    float3 GetCameraPosition() { return _WorldSpaceCameraPos; }

    When I query unity_StereoEyeIndex, it's always 0 in my shader. How might I properly connect this camera rig to my shader?