Search Unity

Question Issue with object/model drifting after placing on an AR Plane

Discussion in 'AR' started by umesh_unity109, Mar 18, 2021.

Thread Status:
Not open for further replies.
  1. umesh_unity109

    umesh_unity109

    Joined:
    Jan 24, 2021
    Posts:
    9
    We are facing some issues with drifting/positioning and elevation problems with a model placed on an AR Plane. Our model is bigger than the average 3d model used in Unity (20+MB, with around 1M Tris and Verts) and is parented to an empty GameObject which acts as our pivot point and then instantiated at the plane.

    
We tried a lot of things on Unity’s side like changing Lighting settings, camera settings, project settings but nothing helps.
    We tried executing the placement of the object in different ways (in Update function, in a separate co-routine and then stopping the co-routine), but that doesn’t help either. We tried updating the plugins but XR-Management plugin doesn’t allow us to do it (known issue: https://answers.unity.com/questions...369.777550575.1615883600-516132349.1615883600) so we are basically stuck with 4.1.1. We are facing the same kind of drifting on both Android and iOS devices.

    Please let us know how to debug the cause of the drifting, we would appreciate it immensely.

    Plug-ins and Tool Versions :

    Unity Editor: 2020.1.8f1
    AR Foundation : 4.1.1
    ARKit : 4.1.1
    ARCore : 4.1.1
    XR-Plugin Management : 3.2.16

    Model size : 20+MB
    Tris and Verts count : 1M+
     
    Last edited: Mar 25, 2021
  2. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    Hi, I don't think size of the object matter unless it affects performance of the app but even that I don't think it would affect drifting.

    Have you tried using an ARanchor component on your empty gameobject? The ARanchor will adjust when the ARsession is being adjusted.

    See if that helps
     
  3. umesh_unity109

    umesh_unity109

    Joined:
    Jan 24, 2021
    Posts:
    9
    Probably should have mentioned this, but we have already tried adding an ARAnchor component to the parent object as suggested in the AR Foundation documentation :


    if (parent.GetComponent<ARAnchor>() == null)
    {
    parent.AddComponent<ARAnchor>();
    }


    We still see the same kind of drifting even after adding the ARAnchor component. Thanks for the response.
     
  4. FrankvHoof

    FrankvHoof

    Joined:
    Nov 3, 2014
    Posts:
    258
    Have you checked the performance of the application while running on the device?
    I'm guessing the object is stressing your device, which might reduce the number of updates that ARKit/ARCore are able to perform (per second), by pushing them to a 'background-thread' in the OS. This would result in less accurate positioning.
     
    danUnity likes this.
  5. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    That's a good point made by FrankvHoof here!

    Have you also tried with just a simple cube instead of your model? Does the cube slide too?

    Also make sure the height of the object is right on top of the discovered ARplanes since if it's at a different height then you'll get moving too.
     
  6. umesh_unity109

    umesh_unity109

    Joined:
    Jan 24, 2021
    Posts:
    9
    @FrankvHoof What exactly do we need to look for while profiling the application? (FPS/GPU Draw Calls/Memory Usage or is it something more specific to ARKit/ARCore?)

    @danUnity We have tried the same with a simple cube and a sphere; they have the same kind of drifting. The drifting is horizontal.

    Can you please elaborate on this? That would be very helpful.
     
  7. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    Hi,

    Well if you have the same issue with a simple cube then it's not the fps the issue. What your fps when running the profiler?

    You have to make sure your object is sitting right on top of the ARplane otherwise you'll get displacement when moving the camera in AR.

    You should buy the asset AR foundation remote on the asset store if you are serious about this since it will allow you to test all that very quickly and see the issue quickly too within the editor.
     
  8. umesh_unity109

    umesh_unity109

    Joined:
    Jan 24, 2021
    Posts:
    9
    Hi @danUnity thanks for the response!

    We get a steady 60 FPS before placing the model and after placing we get around 40-45 FPS.

    How do we check that the object is sitting on top of the AR Plane? We are instantiating the model at the AR Plane position using an AR Raycast, as suggested in the documentation.

    Thanks for the suggestion, we will check this asset, it would definitely help.
     
  9. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    To check if it sits on it, you could change the ARplane shader to be able to view it and then after you instantiated the object, you move your camera down to the floor to see if it's directly on top of it.

    The AR Foundation Remote would definitely help with that task.
     
  10. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    If you're using Unity 2020, you should upgrade to Unity 2020.3, which is the LTS version.

    If the model is heavy enough to cause a drop below 60fps, that will negatively impact AR tracking. Simplifying the model to be lighter to achieve 60fps should improve AR tracking quality.
     
    umesh_unity109 and danUnity like this.
  11. Pilltech101

    Pilltech101

    Joined:
    Jul 25, 2014
    Posts:
    35
    Can you add the ARAnchor to a prefab in editor and still get the same effect ?
     
Thread Status:
Not open for further replies.