Search Unity

Unity scale does not seem to fit real-world scale

Discussion in 'VR' started by nilsubimax, Nov 27, 2017.

  1. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    I already posted this to the Mixed Reality Toolkit issue tracker over on Github, but figured asking this here will bring some more attention to the issue.

    When creating a hologram in Unity that has a size of 10 units it does not cover 10 meters in the real-world. The object needs to be upscaled to 1.0155 to 1.018 in order to really be 10 meters long.
    I found that this is reproducible among multiple HoloLenses and does not seem to be related to world-drift (see Github issue for more details).

    I also created a repro-project for this.

    Any ideas why this is happening? Has someone else noticed something like that?
     
    ali-fadavie likes this.
  2. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Hey nilsubimax, sorry this didn't get responded to. Are you still looking for help on this? I can take a look at your project you posted.
     
  3. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    Yes, still have no idea where to look further to be honest :/

    My next idea would be to measure the Spatial Mesh I can download from the HoloLens. I'd scan the environment between two distinctable points and measure their real distance vs the distance the Spatial Mesh gives me.

    This could still be a Unity issue as the scale-factor could be added during import of the mesh, but it brings a bit more clarity.
     
  4. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    Ok, just measured the same distance using different methods. Note that you could add/subtract a few cm in regards to measurement errors.

    I took two walls in our office and measured the distance between them:
    1. Official Blueprint: 12.09m
    2. Tape measure: 12.05m
    3. HoloLens Spatial Mesh: 12.11m
    Some notes:
    1. Blueprint: Might be off, not sure how precise it was meant to be
    2. Tape: Measured twice, to make sure we made no mistakes. This is probably our best value we got
    3. HoloLens: +/- a few centimeters, as the mesh does not contain "flat" surfaces to measure easily against
    To be honest I'm more unsure what to think about this than before. Applying 1.55% onto the measured 12.05m would results in ~12.24m. I would've expected this to be the distance given by the HoloLens.

    So yeah, wanted to note this down here, but I can't find something useful.

    Let me know if you can reproduce the issue with my sample project.
     
  5. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    I will take a look. What version of Unity are you using to develop on so I can match your setup?
     
  6. monsdar

    monsdar

    Joined:
    Feb 13, 2016
    Posts:
    2
    I'm using 2017.2, along with the MRTK release for that version. I've added some more info in the GitHub issue (link above, sorry, on mobile)

    Edit: sorry, also my private account ✌
     
  7. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    I'm seeing a few compile errors when opening your GitHub. 3 missing namespace references. Can you correct that in your GitHub and then I will clone it again and take a look to see if I see anything weird going on.

    Assets/SetPosToCam.cs(1,7): error CS0246: The type or namespace name `HoloToolkit' could not be found. Are you missing an assembly reference?
    Assets/SetPosToCam.cs(4,43): error CS0246: The type or namespace name `IInputClickHandler' could not be found. Are you missing an assembly reference?
    Assets/SetPosToCam.cs(14,32): error CS0246: The type or namespace name `InputClickedEventData' could not be found. Are you missing an assembly reference?
     
  8. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    Hey, sorry for not responding. I did not get a notification on both accounts :/

    I did not put the Holotoolkit into the project as that would've increased the size of the repo by a lot. You'd need to download the MRTK version for your Unity version and import it to the project. Here are the releases: https://github.com/Microsoft/MixedRealityToolkit-Unity/releases

    Thanks for looking into that, sorry again for giving no answer for so long.
     
  9. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Would you mind building that for me then I can take a look. We don't support or work with MRTK here, but if you can give me a repro-project with everything I need to reproduce your issue I'm happy to take a look. If it's too large to attach to the bug, you can use something like owncloud to send me a shareable link that I can download from.
     
  10. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    I added the MRTK v2017.2.0 to the Github repo. You should now be able to build the project with Unity 2017.2.0f3 out of the box. Keep in mind that the project needs to be deployed onto a HoloLens in order to see the issue.

    When you say building the project - what exactly do you need? The compiled appxbundle with dependencies?
     
  11. StephenHodgson-Valorem

    StephenHodgson-Valorem

    Joined:
    Mar 8, 2017
    Posts:
    148
    I'm pretty sure this isn't an issue with the MRTK.

    We use it for our apps and need pretty good real world geo precision on some key projects.

    Be sure to check your scripts and see if there might be something scaling your objects improperly. Or it could be that the position of the cube is not very precise either.
     
    Last edited: Feb 8, 2018
  12. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    In order to exclude any errors on my side I created the above sample project. It does only contain a simple script to place the 10m hologram onto the ground, nothing more. Effect is still visible.

    Precise positioning is not the issue, the size of holograms is. Is this something you have to work with too?

    In the MRTK issue I opened up regarding this problem we also discussed positioning and came to the conclusion that the cause is probably not world-drift or something similar.
     
  13. StephenHodgson-Valorem

    StephenHodgson-Valorem

    Joined:
    Mar 8, 2017
    Posts:
    148
    Did you also make sure your 3d model was exported correctly at the right units/scaling?
     
  14. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    I created a cube directly in Unity and gave it a scale of 10.0 to set its length to 10 meters
     
  15. darkgap

    darkgap

    Joined:
    Aug 10, 2018
    Posts:
    2
    This happens for me too, the hologram is placed correctly, and the hologram scale is not changed in any of the script in the program (I've also used a floating text with the object scale to be shure about that).
    The real world object is about 7 cm smaller than the 3d model in the hololens I use, in another hololens is 7 cm longer, it seems like a sensor issue, also because from the rs4 the sensor tuning utility is not anymore available in favor of automatic sensor tuning, in fact it happened that one time the hologram fitted the real object perfectly, and after about 20 mins, without changing anything, the hologram was of different size
     
  16. BroncoBilli

    BroncoBilli

    Joined:
    Oct 8, 2017
    Posts:
    90
    I'm seeing a related issue. Is this still an issue? It didn't seem to be addressed in this question.
    Here's what I did as part of tonight's investigations: I marked off my table with 1' x 1' grid patterns, then set my headset to a known position, 2 feel above the table, pointing dead level. Then centered the headset. Then got the R controller and moved it to different grid locations, 1' apart. Unity measured the delta distance between the controller's locations as 11.95", even though they were exactly 12" (I put thread cross-hairs on the controller, which was laying face-down). This is the part I can't figure out: The MS team that made my Samsung MR headset (not a HoloLens) knows the exact distance between the tracker cameras, and it knows the exact pattern on the controller cuff. How could Unity be reporting the distances as 11.95" when it should be 12"? Doesn't seem like it could be "rounding error". Am I barking up the wrong non-linear tree?
     
  17. BroncoBilli

    BroncoBilli

    Joined:
    Oct 8, 2017
    Posts:
    90
    I still think there is some kind of scaling issue w/ Unity, too. I'm using 2 live stereo cameras, calibrated, and displaying them in Unity, and can't get real-world images to exactly line up with Unity VR objects. There does seem to be a scaling issue....
     
  18. BroncoBilli

    BroncoBilli

    Joined:
    Oct 8, 2017
    Posts:
    90
    I repeated my test, except I used centimeters (much easier), and make more accurate marks this time. It appears Unity's scale for measuring where the controller is, is about 1% off. At exactly 60 cm, the distance reads "60.6". At 50cm, it reads 50.5, and so on, down to reading 10.1cm at actual 10cm. Not bad, but certainly not perfect either. I can deal with it, I'm just surprised it's a linear issue, not just a %-wrong issue.