Generic-Raymarch-Unity icon indicating copy to clipboard operation
Generic-Raymarch-Unity copied to clipboard

VR Support

Open andybak opened this issue 7 years ago • 2 comments

I'll try and take a look myself but I'm trying to find a raymarcher that blits directly to the camera that does work in VR to use as an example. Most tend to use a quad parented to the camera.

andybak avatar Nov 05 '17 17:11 andybak

The alternative being a quad in any position where the vertex shader repositions it at the camera?

hakanai avatar Mar 30 '18 02:03 hakanai

I think the alternative being the solution used here, which is elegant as hell - blit within OnRenderImage, passing the camera matrix, works perfectly with the scene camera. Thank you for making and tutorial-izing this @Flafla2 <3

Any idea what's missing to make this work in VR? It breaks Single Pass, which may be a complicated fix, but Multi Pass should be easy in theory. In Multi Pass the matrix is slightly off, but symmetrically for each eye, the camera does pass a separate matrix for each.

I wasn't able to find a correct matrix in the APIs. I tested it on a Vive, with Camera.stereoActiveEye, and Camera.GetStereoViewMatrix(StereoscopicEye eye). I wonder if the SteamVR_Camera is doing something different on render. But I'm a bit out of my depth with these SteamVR / open XR APIs. For instance I was able to get a projection matrix from SteamVR (with HMDMatrix4x4ToMatrix4x4(SteamVR.instance.hmd.GetProjectionMatrix(evrEye ...)), but not a view matrix. Any ideas?

phest avatar Dec 16 '18 03:12 phest