Skip to main content
sh0v0r
Up and Coming
July 25, 2014

How to do Multilayered Cameras With 0.4

Please see VRDaveb's response for a possible implementation 8-)

There are still problems and there is not a definitive solution that doesn't have issues.

Some people have reported it working for them but not with Image effects.

Current problems are duplicate images in one eye, latency between the updates of the sub cameras.
    This topic has been closed for replies.

    49 replies

    New Participant
    September 25, 2014
    So I'm using the subcamera script for my world cameras, and the main OVRCameras for my UI cameras.

    I'm getting an odd bug where the right eye sees the UI rendered for the left eye as well as the right (as if a render texture for the left eye is not getting cleared before it draws the UI for the right eye)

    If I make the right eye have less depth than the left eye, the bug switches sides (so that the left eye sees double and the right eye is correct).

    I'm going to try making the main cameras render nothing and adding a second set of sub cameras to render the UI, but I'd like to know if anyone else has seen something like this?


    *Edit* found the solution.

    It was a problem of camera depth, specifically that I was rendering pairs of cameras together:

    LeftCamera1 : 0
    RightCamera1: 1
    LeftCamera2:2
    RightCamera2: 3
    etc...

    When I swapped that around to render all the left eyes, then all the right eyes, stuff started working correctly:

    LeftCamera1 : 0
    LeftCamera2: 1
    RightCamera1: 2
    RightCamera2: 3
    Up and Coming
    September 26, 2014
    [EDIT: issue solved]
    I have an issue with a two-layer camera setup as well.

    Any idea how I can get this thing to work with Oculus?

    I'm using forward rendering and DX11 is disabled from Unity.
    I've tried nested cameras (Right/LeftEye OVRCamera gameobject with a child gameobject that has OVRSub Camera script), siphi's approach of several gameobjects with OVRSub Camera script, and several different camera depth value combinations.
    sh0v0r
    sh0v0rAuthor
    Up and Coming
    September 26, 2014
    Image Effects don't work still as far as I know. This issue is still not solvable until the SDK & Unity make it possible to layer multiple camera effects into a single render target.

    I'm no expert but I think the depth buffer is cleared each time a new camera access it.
    Up and Coming
    October 25, 2014
    SDK Version 0.4.3 Beta

    •Improved support for multi-layered rendering. Just instantiate multiple OVRCameraRigs, set Camera.depth and Camera.clearFlags for each eye, and use.


    Woot!
    Please check out the Millennium Falcon Experience , The Battle Of Endor , and TRON: Light Cycles @DarthDisembowel
    sh0v0r
    sh0v0rAuthor
    Up and Coming
    October 25, 2014
    "DarthDisembowel" wrote:
    SDK Version 0.4.3 Beta

    •Improved support for multi-layered rendering. Just instantiate multiple OVRCameraRigs, set Camera.depth and Camera.clearFlags for each eye, and use.


    Woot!


    Yep works pretty much like it did in 0.25 now which is great, also you can enable and disable different controllers without issue.
    New Participant
    October 27, 2014
    Hello ! New user here : ) Been following this thread and well. Are we still stuck in the we cant render image /post effects or is this solved with the new sdk. Trying to get this one working but im not sure it ever will as it is now.

    http://sonicether.com/unitydemos/se_natural_bloom_01/
    Inspiring
    October 27, 2014
    Image effects should work fine with multiple layered cameras now. Unity has fixed a bug in their rendering code. You should be able to instantiate two OVRCameraRigs, set Camera.depth on their child Cameras so both eyes from rig A render before either eye on the rig B. Then you should set Camera.clearFlags = ClearFlags.Depth on both of the child Cameras under rig B. You need Unity 4.5.5f1 or newer and Oculus Unity integration and runtime 0.4.3 for this to work.
    New Participant
    October 27, 2014
    Thanks! i am currently running 4.6 might need to downgrade
    Up and Coming
    December 5, 2014
    "sh0v0r" wrote:
    "DarthDisembowel" wrote:
    SDK Version 0.4.3 Beta

    •Improved support for multi-layered rendering. Just instantiate multiple OVRCameraRigs, set Camera.depth and Camera.clearFlags for each eye, and use.


    Woot!


    Yep works pretty much like it did in 0.25 now which is great, also you can enable and disable different controllers without issue.


    Hmm, I scrapped the complicated but functional setup that I picked up from this thread and just implemented the default setup and I have a significant lag between camera layers again (far cameras rendering are a frame or two behind the near cameras). I may have jumped the gun on this, but I'm a sucker for simplicity. I probably should have left well enough alone, and I might have to revert back to the subcamera script.

    Anyone else have better luck?
    Please check out the Millennium Falcon Experience , The Battle Of Endor , and TRON: Light Cycles @DarthDisembowel
    Inspiring
    December 5, 2014
    That's odd, the two cameras should render with no difference in latency. You might want to double-check Camera.depth. Your near rig's depth should be higher than your far rig's. Have a look at Assets/OVR/Scenes/MultiCamera.