Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

What is the best way to match / overlap 3D content to a model target with the same shape?

Discussion in 'AR' started by R42_Leon, Aug 17, 2019.

  1. R42_Leon

    R42_Leon

    Joined:
    Feb 24, 2016
    Posts:
    25
    I have been creating the .arobject reference following the instructions in here: https://developer.apple.com/documentation/arkit/scanning_and_detecting_3d_objects - managed to get the tracking done in ARFoundation, placing a mesh on the tracked point position, all good so far.

    Now I want a model target to be overlapped in AR by its 3D counterpart (say I have a machine part and its .cad file; or a 3D print I want to augment in 3D) - what is the best workflow to achieve this with ARFoundation? I have been banging my head on this for a while and found no satisfactory way.

    Judging from that apple link, I thought the accepted way was to save the 3D mesh as an USDZ file, then load that into the AR scanning app on the phone, move and rotate it to match the printed object. Then, technically, using the same exact file in Unity, and transforming it to the tracked object's position, rotation and scale, everything should fall into place, right?

    Wrong, it's still all over the place. What's really weird is that the simple act of adding an USDZ file to the scanning process seems to jumble up the .arobject's transforms, regardless of me moving it or not.

    Here's an .arobject scanned from a 3D print - no USDZ added:
    upload_2019-8-17_18-34-4.png

    Same 3D print scanned, this is with an USDZ added during the scanning process (and left untouched):
    upload_2019-8-17_18-34-24.png

    Same 3D print, with an USDZ added, and moved around to try and match the real life 3D print:
    upload_2019-8-17_18-34-45.png

    In the first case, the reference origin seems somewhat reasonable, and placing a mesh in those coordinated does result on the mesh being placed on top of the model target (although in no precise way whatsoever), but in the other two cases, those 10 to 100+ units offsets basically shoot my mesh out of visible view.

    I thought it might have been my converted USDZ file screwing this up, so I tried downloading one of Apple's pre-made files from here https://developer.apple.com/augmented-reality/quick-look/ - I still get the same problems.

    Has anyone figured out a working workflow around this? I have worked with Vuforia's model targets in the past and what they do is providing an in-editor preview mesh of the tracked model, so that you can assign a gameobject as its child and place it accordingly, and it all translates correctly to the AR experience. Does the .arobject format even allow something like that (if I am not wrong the file doesn't store any kind of 3D representation, just sets of data to recognized patterns and points)?

    Any help with this would be greatly appreciated. I think that not having a reliable method of having a tracked model being overlapped by its 3D counterpart pretty much defeats the point of model targets...
     
    VHornet likes this.