Search Unity

Cardboard not giving realistic scale

Discussion in 'AR/VR (XR) Discussion' started by sv54, Aug 29, 2018.

  1. sv54

    sv54

    Joined:
    Aug 24, 2018
    Posts:
    7
    I'm new to Unity and test building a Cardboard, Unity->iOS app.
    So far, my test is failing to get the correct visual angle. My objects are too big.

    Test: put a 1cm object 57cm away
    If working: the object should be about 1-degree (visual angle)...given a device FOV of 90-degrees, then the object should be 1/90th the total FOV
    Instead it's 1/6th of the FOV on the iphone and 1/16th the FOV in the Unity preview window

    Details:

    Import Google Cardboard SDK package

    Assume, define 1 unit=1 meter.

    1. place the mono-camera at z=0...assuming Unity-GVR SDK puts the L,R cameras at z=0 and the appropriate x,y offsets

    2. put a (0.01, 0.01, 0.01) (x,y,z) plane at 0.57 units = 57 cm

    3. set the FOV to 90 (the cardboard per lens FOV)

    4. build to iOS

    5. scan QR for my specific Cardboard viewer

    The result should be that the plane takes up 1/90th of the visual field. Since assuming 0.01 units = 1cm, then 0.01 units = 1 cm = 1 visual degree at 57 cm distance.

    Not sure if this is a problem with how I setup Unity or an issue on the iOS side.

    I'd like to understand how Unity is meant to work such that my unit acts like a meter in this test case.

    unity_scale 1.20.53 PM.png
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Probably your FOV isn't actually 90 degrees. The FOV is set by the XR system when in VR mode; what you set for it in Unity doesn't matter.
     
  3. sv54

    sv54

    Joined:
    Aug 24, 2018
    Posts:
    7
    Thanks, but my image is about an order of magnitude off from the likely FOV for the device... which I think is more like 50 degrees, not 90 that’s often reported. Still the image should take up 1/50th of the viewing plane not 1/6th.
     
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Ah. You're assuming a plane is 1 unit wide. It's not; it's 10 units wide.

    Try it with a cube, and I bet it'll work as expected.
     
  5. sv54

    sv54

    Joined:
    Aug 24, 2018
    Posts:
    7
    Well I set the the plane to be .01 units wide, tall and the distance to be 0.57 units. Well that’s what I put into the editor. That should give an angle of one. So, not sure why you’re saying it’s actually 10. I’ll try the cube suggestion though and get back to you. 1 unit though is going to be too big if I place it at 0.57 units away but I’ll try.
     
  6. sv54

    sv54

    Joined:
    Aug 24, 2018
    Posts:
    7
    Thank you

    Yep, cube seems to work (see attached, cube is above the plane..both have same scale and distance specifications). Passes eyeball test, cube is about 1/50th of screen as expected.

    IMG-3270.PNG

    Looking it up now that you mentioned it, I guess this is a Unity-specific issue with how it handles planes...they are 10 units not 1 unit (as you said)

    If I take this into account, then I get the right scale for the plane (set is as 1/10th of what I want). Cube is white and plane is magenta (10x smaller scale specification than cube).


    IMG-3271.PNG
     
    Last edited: Aug 30, 2018
  7. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    The Scale parameters in the Transform do not mean "how big is this object." They are simply a multiple of the standard size of that object. If a human model is normally 1.7 m tall, and your Y scale is 2, then it will be 3.4 m tall (not 2 m). If a house is 30 m wide, and the scale is 0.1, then it will be 3 meters wide (not 0.1 meters wide).

    It just so happens that the built-in cube and sphere models are 1 unit wide, and a plane is 10 units wide, at their standard size. This is because the plane is most typically used as a floor, and I guess the designers at Unity didn't think a 1x1 m floor was typically useful.
     
  8. sv54

    sv54

    Joined:
    Aug 24, 2018
    Posts:
    7
    Gotcha.. scale parameter of course has no units...just a multiple. I had assumed it was multiplying 1 unit but it's actually 10 units for a plane (as you pointed out).

    Would have been good if I read this document.

    https://docs.unity3d.com/Manual/PrimitiveObjects.html

    I edited my last comment, so as not to confuse others.
     
    JoeStrout likes this.
  9. sv54

    sv54

    Joined:
    Aug 24, 2018
    Posts:
    7
    My guess is that the plane is larger due to a desire to tile, cover it with more triangles. Perhaps this gives better looking floors..for example when shading, rendering light, etc.

    I accidentally used this instead of a quad, which is a simpler object.