How to set a render-to-texture camera to be a VR camera
So, I want to do some post processing effects in VR. I put a camera as a child of the Main Camera and set it to render-to-texture. Then, I take what is rendered, and display it (with my post-proc shader) on a quad in front of the Main Camera (The main camera and the child camera render different layers, so I don't render the same thing twice). (Also worth noting- I know that the depth will be collapsed out of the rendered-to-texture content; this is intentional.) The problem is, in this process, the positional data (that was rendered to texture) gets misaligned.
I've already fixed a problem where I have to manually set camera_project.GetComponent<Camera>().aspect = main_camera.GetComponent<Camera>().aspect;
every frame. (Changing/setting the screen size auto sets the aspect ratio of the main camera- it does not automatically set the aspect ratio of the child camera.
So, with just that, everything lines up great and looks fine when it isn't in VR. But, when it is in VR, it appears that maybe some distortion is happening to the main camera that isn't happening to the render-to-texture camera, and thus, the overlay (the post-proc'd content) isn't lining up.
So what can I do to emulate the VR distortion in the child camera? Are there other properties of the Main Camera that are getting auto-set in VR that I can manually copy to the Main Camera? (I also noticed that aspect
wasn't listed in the camera documentation [https://docs.unity3d.com/Manual/class-Camera.html] unless you knew to search for it explicitly, so I think it might be likely there is some other property I'm missing?)
Your answer
Follow this Question
Related Questions
GrabPass for local distortion effect problem 0 Answers
Unable to Launch Game:Shaders Problem 0 Answers
Completely disable SteamVR and stereoscopy 0 Answers
AR Camera Projection 0 Answers
Unity UI not rendering for left eye (Stereoscopic 3D) 0 Answers