Skip to main content
Participant
August 17, 2013

Multiple layered cameras for large viewing distances...

For our game WSF (a realistic wingsuit simulation) we need a very close near clip and very far far clip planes. For the non VR version we solved this by having three cameras layered on top of each other:

Near Cam - Nearclip/Farclip: 0,01/2,20 - Depth: 0 - Clear Flags: Depth only
Mid Cam - Nearclip/Farclip: 2,00/5010 - Depth: -1 - Clear Flags: Depth only
Far Cam - Nearclip/Farclip: 5000/25000 - Depth: -2 - Clear Flags: Skybox
(little overlap is necessary to cover ptential gaps)

In our VR version we want to do the same but it is a bit tricky. I was thinking i could just parent the Mid and Far Cam to the Near Cam and apply the lens correction only to the cam rendered on top... From what i see, OVR used render to texture for the lenscorrection so this approach is not working. So far so good, then i was thinking i just apply the LC to all cameras but this is still not working. When looking through the Rift i see everything doubled. I assume the LC need the cameracontroller and the Cameracontroller can only handle 2 cameras.

So my workaround now is to have 2 complete OVR camera controllers layered on top of each other(very similiar to the solution above) and it works but of corse it is not an ideal solution. The tracking has to be done twice and when i move my head quickly i can see the edge of the first OVR camera controller moving at different speed than the second.

I'm no coder but an artist, so sorry if this is a stupid way to do it... however, if someone here has messed with such a muticam setup and can put me on the right track i can get the help of a programmer. It would help a lot if i can point him into the right direction. Help is much appreciated!! So..., is there a better way to do a layered multicam setup than just using multiple camera controllers?

Thanks,
Peter
    This topic has been closed for replies.

    30 replies

    Participant
    September 1, 2015
    Never mind - dumb - dumb - dumb mistake.

    I saved my "new" scene with a slightly different name and didn't notice when I compiled that I was using the old scene.

    Multiple cameras work perfectly!

    I use two OVRCameraRigs but I can't help but wonder if that is the way Oculus envisions us to do this? It just seems a little - well - non-elegant. I would think they might rather add the ability to add additional cameras to the CenterEyeAnchor to do the same job.
    Up and Coming
    September 15, 2015
    Hey monsenrm,

    This has got to be my first forum post in ages!

    Can you tell me how you got that to work exactly? I finally decided I'd try to get this working, as I have some very large and very distant deep-space objects to render.

    I made two OVRCameraRigs, and it almost looked like it was going to work, but something about having a second nested camera made the player controller break entirely and not respond to input. Can I ask where you placed your second OVRCameraRig?
    -- -- --
    Inspiring
    September 15, 2015
    See vrdaveb's suggestion here: viewtopic.php?f=37&t=26416&p=295714#p295714
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    September 17, 2015
    Hmmm that's how I already had it set up. It was working, as in, rendering my skybox and distant objects just fine with the second camera, but something about having a second rig in there was stopping locomotion on behalf of the player controller obj.

    Now, that's if I make it nested under the player controller alongside the other camera. Is there a stipulation I should know about?

    If I leave it sitting there separate from the player, it seems to work, but I'd need to make a script to apply player rotation to it, or it doesn't rotate properly when the player does (obviously)
    -- -- --
    Inspiring
    September 17, 2015
    There are errors in the console you need to fix first. You'll need to change OVRPlayerController.cs around line 118 to:

    else if (CameraRigs.Length > 1) {
    Debug.LogWarning ("OVRPlayerController: More then 1 OVRCameraRig attached.");
    CameraRig = CameraRigs[0];
    }
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    September 17, 2015
    Thanks so much cyber! Missed that. I can now have both rigs and move. Oddly though, I gotta figure out now why the Y rotation of the camera seems to double up on itself and rotate the skybox more than it should. Probably doing something ignorant :)
    -- -- --
    Inspiring
    September 17, 2015
    Skybox seems to work for me, maybe something strange with your project.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    September 17, 2015
    Yeah you're right, I just made a blank scene and applied the same camera setup/skybox and it's fine. So something is messing with it, but I have no idea what. Guess I'm at another indefinite standstill haha. I've got no code that touches cameras at all. So weird. Good stuff, Unity... Thanks for the assistance man. :)
    -- -- --
    Up and Coming
    September 27, 2015
    False alarm. It only looked like it was working (duh) because I didn't add distant objects yet.

    Now I'm having another issue that's probably related.

    Here's a high-res video of what's happening, and I hope it's easy to follow: https://www.youtube.com/watch?v=3XH5WejcYzo


    Essentially, it looks like it's gonna work, and then in my Game View, many objects from the main Oculus CameraRig aren't rendering at all, or their shapes in relation to the close camera are creating a mask through which to render the distant-view CameraRig? Very bizarre!
    -- -- --
    Inspiring
    September 27, 2015
    That setup looks mostly correct. Try using Unity 5.1.3p2 or 5.2.1p1, where we fixed a problem with the shape of the frustum used by culling. If that doesn't help, can you try making the hand-off occur at 100 instead of 2000? 0.01-2000 stretches the numerical range of depth testing pretty thin.