OSVR / OSVR-Unity

Package for authoring OSVR experiences with Unity.
Apache License 2.0
98 stars 38 forks source link

Multiple Cameras(Surfaces?) for one eye #156

Closed MarcinRNowak closed 8 years ago

MarcinRNowak commented 8 years ago

Hello,

I have large space scene, that should have very long viewing distance. I would like to use 2 cameras for each eye, one for a short view distance and second for longer one, so I can expand total near to far plane distance. For example my first camera would have parameters: near: 0.3, far: 1000 Second camera: near: 1000, far: 100000.

Could you please guide me how to do that? I guess I would need to modify VREye code to make it possible to use multiple VRSurfaces? Any suggestions will be greatle appreciated!

Best Regards, Marcin

DuFF14 commented 8 years ago

Hi @MarcinRNowak, OSVR-RenderManager currently only handles one RenderTexture per eye. It might work if you can render both cameras to the same RenderTexture that is shared with RenderManager. Use the OSVR surfaces as your near cameras, and create your far cameras the same way somewhere around here: https://github.com/OSVR/OSVR-Unity/blob/master/OSVR-Unity/Assets/OSVRUnity/src/VREye.cs#L167

I don't know if this works in Unity but I would try something like: cameraFar.renderTexture = cameraNear.RenderTexture;

and then rendering the far camera before the OSVR surfaces https://github.com/OSVR/OSVR-Unity/blob/master/OSVR-Unity/Assets/OSVRUnity/src/VRViewer.cs#L221

Again, I don't know if it will work with the shared renderTexture. If not, you can try blending them together.

MarcinRNowak commented 8 years ago

Hi,

Thanks a lot for your reply. I actually started working on exactly what you wrote just day before and it worked!

Cheers, Marcin