Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Beginner Questions - Is room tracking a thing?

Discussion in 'AR' started by GaryFrewin, Sep 26, 2021.

  1. GaryFrewin

    GaryFrewin

    Joined:
    Nov 9, 2020
    Posts:
    18
    Hi Folks,

    I've done a lot of development for apps and dabbled in VR, but AR is completely new to me. I'm wondering if what I'm trying to do is even possible before I start learning (I'm having trouble finding good info).

    I have a 1:1 3d model of my garage/climbing wall in Blender. I'd like to build an AR app so that I as I move my phone around in my real garage, it aligns the room with the 3d model.

    Is the room tracking/alignment thing a thing? Would I need to paint markers on my real wall that the app would track and use to position the 3D model? Is it possible to do it markerless? Any good tuts on this?

    There's plenty of similar tutorials for VR i..e how to build a vr apartment and align it will your real apartment... but how to do it in AR on a phone?

    Thanks
     
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,128
    Unfortunately, there is no simple and automatic solution to this problem in AR Foundation.

    Currently, only 'relocalization' solutions are available: ARKit World Map and Persistent ARCore Cloud Anchors. 'Relocalization' means that if you stick virtual objects to real-world objects in one AR session, you can restore positions of virtual objects in the next session.

    So for a case like yours, it would be:
    1. Start AR Session and let ARKit/ARCore collect data about the environment.
    2. Place ARAnchor (or Cloud Anchor).
    3. Position your virtual object manually to align with the real world. Using ARRaycastManager can help here.
    4. Save the position/rotation of your virtual object relative to the placed anchor.
    5. Now you can restart the app, relocalize the anchor's position with the help of the ARKit World Map or ARCore Cloud Anchors, and restore the position of your virtual object relative to the anchor.
     
  3. GaryFrewin

    GaryFrewin

    Joined:
    Nov 9, 2020
    Posts:
    18
    Great thanks for the reply. I'll have a read up on the ARAnchor docs later and see if I can get started from there.

    :)
     
  4. GaryFrewin

    GaryFrewin

    Joined:
    Nov 9, 2020
    Posts:
    18
    HI again,

    So I got this set-up. I am using an image tracker to place my 3d model of the room when the app recognises the image. This is all working really nicely, except...

    I'm getting a lot of drift/movement in the 3d model as I move the phone around. Are there any approaches that could be use to 'firm up' the tracking?

    At the moment it's just one image at a location in the room and the 3d model of the room is parented to ARTrackedImage. Lots of tutorials talk about having reference images to track, but these usually instiate separate objects on each reference image.

    Can I, for example, have multiple reference images for the 3d room object, so that I can stick references to the real walls in specific locations, then the 3d model is constantly realigned as I move around the room and it the different images are tracked?