void OnEnable() { var vr = SteamVR.instance; if (vr != null) { var proj = Matrix4x4.Perspective(vr.fieldOfView, vr.aspect, 0.1f, 1000.0f); var invProj = proj.inverse; eyeData = new EyeData[2]; for (int i = 0; i < 2; i++) { var eye = (Hmd_Eye)i; uint x = 0, y = 0, w = 0, h = 0; vr.hmd.GetEyeOutputViewport(eye, ref x, ref y, ref w, ref h); eyeData[i].kernel = new Vector4[] { // AA sub-pixel sampling (2x2 RGSS) new Vector4( 0.125f / w, -0.375f / h, 0.375f / w, 0.125f / h), new Vector4(-0.125f / w, 0.375f / h, -0.375f / w, -0.125f / h)}; eyeData[i].invProj = invProj; } } SteamVR_Overlay.instance = this; SteamVR_Utils.Event.Listen("new_poses", OnNewPoses); }