Skip to main content
Up and Coming
November 3, 2015

Stereo Lens Flares in Unity 5.2.x w SDK 0.7

Hi, I had some lens flares I was using with Unity 5.0 / SDK 0.5...
I simply added a Flare Layer to each of the Eye cameras, and voila, I had stereo lens flares.

Now, There appears to be only one camera in the "OVRCameraRig" object, attached to "CenterEyeAnchor"
When I assign a Flare Layer to that, it renders monoscopically, which messes with the player's vision and contradicts the 3d visual signal.

I've tried copying the camera component from the CenterEye to the Left- and Right-eye objects, then manually assigning the Target Eye field on each of those, with a Flare Layer on each, but it appears that the Oculus codebase then de-activates my L adn R cameras at runtime, leaving the screen black.

Does anyone have lens flares working in stereo with SDK 07 + Unity 5.2.x, and if so,
can you please list steps to reproduce?

Thanks in advance,
    This topic has been closed for replies.

    3 replies

    dsky9Author
    Up and Coming
    November 3, 2015
    Until I get better resolution on this, I'm using the "Sun" flare instead of the "50mm" lens flare. The sun flare is centered around the light source with simple radial beams, so even when rendered in mono, it doesn't give visual conflict that the 50mm does with its far flung rings and hexagons.
    dSky builds the worlds best VR apps for SCIENCE. GPU : HD 7990 6GB, CPU : i5-4690K @ 3.5GHz, MB : Asus Z87, RAM : 16GB DDR3, PSU : EVGA 850w, mouse : Razer Naga, kybd : MS Sculpt Ergo, OS : Win7sp1, OC : 0.8.0, HMDs: DK2 + GearVR, LAP : 2012 MBAir
    Inspiring
    November 7, 2015
    This appears to be a limitation in the way Unity renders flares. We've reported it. For now, I'd recommend using two separate Cameras. Instead of putting Cameras on the left/rightEyeAnchors, you'll have to duplicate centerEyeAnchor and comment out the following lines in OVRCameraRig.cs. Then try setting the "Target Eye" on each one to "Left" or "Right" instead of "Both". Then you should be able to add a separate Flare Layer to each Camera and get correct results. Please let me know if that doesn't work.
    					Debug.LogWarning("Having a Camera on " + cam.name + " is deprecated. Disabling the Camera. Please use the Camera on " + centerEyeCamera.name + " instead.");
    cam.enabled = false;
    dsky9Author
    Up and Coming
    November 16, 2015
    @vrdaveb, Thanks so much for this. I'm on another project for a bit here, but I've copied the post and sample code and will plug it in and test it as soon as I have a little time available. Oh, here is the actual experience we're using it in:

    http://dsky.co/solar/
    dSky builds the worlds best VR apps for SCIENCE. GPU : HD 7990 6GB, CPU : i5-4690K @ 3.5GHz, MB : Asus Z87, RAM : 16GB DDR3, PSU : EVGA 850w, mouse : Razer Naga, kybd : MS Sculpt Ergo, OS : Win7sp1, OC : 0.8.0, HMDs: DK2 + GearVR, LAP : 2012 MBAir