Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

LODGroup in VR

Discussion in '5.6 Beta' started by Claytonious, Feb 8, 2017.

  1. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    903
    We initially ran into this on the Google Daydream technical preview but the problem persists in 5.6 beta so I'm posting here, too...

    LODGroup behaves very differently in Daydream and GearVR on device than in the editor. It seems to select *far* lower LOD levels at the same distance on device than in editor. I've seen some whispers of this for Gear VR, where people are simply doing things like setting their QualitySettings.lodBias = 3.8 when they're not in the editor.

    What's the correct answer here, though? Is this a bug? Or is this expected since the display is in stereo and the screen size of objects is actually smaller on each display, even though it would be larger if the entire display were a single eye?

    I submitted bug report case # 879100 which has a simple repro project that demonstrates the problem, but I'm wondering if it's simply a matter of correct setup.

    Thanks!
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    Ok, the root issue appears to be that the main camera that renders in editor has n FOV at 60d, while the device FOV is 90d. If you change the main camera FOV to 90 you'll replicate the same thing you see on device.

    From playing around I can see that a bias of 3 should get you to match the 60d main camera on device but that isn't very scientific. I am working with the GFx team to determine a correct equation that will give anyone a correct bias value for cameras with mismatched FOVs.
     
  3. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    OK, here is the equation: LODBias1 * (tan(FOV2/2)/tan(FOV1/2)) where:
    LODBias1 is the LODBias for the first camera you are coming from (in this case main camera)
    FOV1 is the FOV for the first camera (again main camera) in radians.
    FOV2 is the FOV for the second camera (in this case Daydream) in radians.


    For main camera we have FOV1 = 60 degrees = pi/3 radians, LODBias = 2
    For the Daydream camera we have FOV2 = 90 degrees = pi/2 radians

    So: 2 * (tan(pi/2/2)/tan(pi/3/2)) =
    2 * (tan(pi/4)/tan(pi/6)) =
    ~3.46

    You should be able to wrap that into a C# function and have your VR LOD Bias set correctly or you can just manually calculate it once and use that.
     
  4. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    903
    @joejo , that is just fantastic and unbelievably helpful. Thank you so much.

    It now makes sense why folks over on the GearVR Oculus forums experimentally arrived at a magic lodbias value of "3.8" that "seemed to make things work right" for them.

    This is going to be a chronic issue for VR folks - you guys should consider either putting this snippet of yours into the documentation for LODGroup or just baking that behavior into it.

    But anyway thanks again.