Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
PixelRouter's avatar
PixelRouter
Explorer
10 years ago

How Do We Layer Cameras using Utilites For Unity?

I'm finally able to do this properly using Unity's integrated VR support, but can't figure out how to do it using the prefabs that come with the Utilities for Unity.

Using the native VR implementation, its a simple matter of attaching a second camera to whatever node your first camera is attached to and then setting the second camera to Depth:1 and Clear:DepthOnly. This just works and its really nice to be able to effect my cockpit differently than the outside world.

This is what my working setup looks like :



What is the right way to do this using the more feature rich prefabs that come with Oculus Utilities for Unity?

I can't figure out where to put a second camera.

2 Replies

Replies have been turned off for this discussion
  • You can duplicate CenterEyeAnchor (which has the camera on it) and I think it should work. However you may have to comment out some lines in OVRCameraRig.cs (you'll see the error in the console if it disables your new camera).
  • If you don't want to make a script change, the way we test this is by creating two OVRCameraRigs and setting the depth, clear flags, clip planes, and culling masks on the CenterEyeAnchors of each as follows:

    Far Rig:
    - Depth = 0
    - Clear flags = skybox (or solid color)
    - Culling mask = world
    - Near clip plane: 10
    - Far clip plane: 10000

    Near rig:
    - Depth = 1
    - Clear flags = depth only
    - Culling mask = cockpit
    - Near clip plane: 0.01
    - Far clip plane: 10