Search Unity

Stereo camera positions with shader

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

  1. rtbz

    rtbz

    Joined:
    Jan 18, 2017
    Posts:
    11
    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?