Search Unity

ARFoundation Place on Plane unstable

Discussion in 'Handheld AR' started by Edur-Games, Oct 12, 2018.

  1. Edur-Games

    Edur-Games

    Joined:
    Nov 21, 2017
    Posts:
    46
    Hello.
    I would like to know if you know any technique to improve stability by placing an object on the plane in ARFoundation. Compared to other AppStore games (The Machines) using the same place to place an object, same light.. My project I'm developing sometimes floats in the air and vibrates constantly.
    It takes a while to stay still but it's not very stable.
    This does not always happen so exaggerated, but I never get it to be placed without moving on its own.

    Any suggestions?
    Thanks a lot!
     
    Saicopate and dyuldashev like this.
  2. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    61
    I have the same problem. I checked how other iOS and Android AR apps worked under the same lighting conditions, and once those apps find a plane, it's so stable. I don't really know if it's a Unity issue because Unity AR Kit is performing poorly as well. We would like to know what is causing this because AR Foundation is extremely unstable...
     
  3. tkrikorian

    tkrikorian

    Joined:
    Jan 2, 2018
    Posts:
    4
    Hi,

    I also have this issue. When using ARCore plugin without ARFoundation i have better tracking than with ARFoundation.
     
    soorya696 and dyuldashev like this.
  4. Edur-Games

    Edur-Games

    Joined:
    Nov 21, 2017
    Posts:
    46
    karsnen, GreeneMachine and dyuldashev like this.
  5. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    I understood ARFoundation is a layer on top of the Unity ARKit plugin... ? Does this mean the ARKit "package" we are using with ARFoundation is out of sync with the ARKit Plugin available via BitBucket that you mention here?

    Why would it not be as stable in terms of tracking.. surely ARFoundation sits on top of ARKit.. isnt that the idea of it?

    I'm using ARFoundation for its scaling functionality... anyone implement their own scaling with ARKit plugin outside of ARFoundation? I didnt read too much into it (ie. the blog/gdc vids).. as I expected ARFoundation to work.. .but I'm not happy with its performance to date and the lack of response on this forum from Unity.

    Cheers guys
     
    dyuldashev likes this.
  6. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    61
    Guys, let's all try this. Set both ARSession Origin and AR Camera rotation/position values to 0 (for x, y, and z). And check how stable it is. Because for me, it's kind of getting a lot more stable. Let's check this out as a community. Thanks :)
     
  7. tkrikorian

    tkrikorian

    Joined:
    Jan 2, 2018
    Posts:
    4
    ARSession & ARCamera was already at 0,0,0 for me. I think having ARSession / ARCamera different than 0,0,0 would cause the scene to shift.
     
    dyuldashev likes this.
  8. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    61
    My project was not set to (0, 0, 0), and I think it's because the GitHub sample does not set it to (0, 0, 0) to begin with. So, the first step would be to set both AR Session Origin and its child Game Object(AR Camera) to (0, 0, 0). That improved things a lot for me. I wonder if other people have different suggestions? I have read that AR Foundation sets the frame rate to 30 on iOS devices unlike AR Kit. Might that affect things? What else could help us improve the stability?
     
  9. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
  10. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    61
    Up until you find a plane, try setting everything to (0, 0, 0). Afterwards, of course, with scaling, it will get changed. I am referring to that initial ground/vertical plane detection part.

    Second, I tried setting the target frame rate to 60 FPS, seems to help a bit as well.
     
    GreeneMachine likes this.
  11. Edur-Games

    Edur-Games

    Joined:
    Nov 21, 2017
    Posts:
    46
    Hey!

    I have been experimenting and testing with different versions of the plugin ARKit (ARFoundation, Unity ARKit plugin...)

    I think the problem of tracking, that objects vibrate when placed on a surface and all these problems we have can be due to scaling objects especially when they are very large objects that we want to reduce using the option of scaling.

    Maybe I'm wrong, I'm just trying.

    Do any of you have problems without scaling objects?

    With the old plugin ARKit I put the same object on the surface but with the difference that I reduce the scale of the object itself (which is a bad practice for physics issues) but at the time I put the object in the plane , it's not moving, it's very stable.

    So I said in the previous post if it can be problems of the double camera, scaling objects etc..

    I'm sorry, but I'm a little desperate about this

    Best regards
     
  12. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    61
    The only plausible insight I have is this. You are detecting a ground plane, and let's say its area is 3 m^2. And the placed content area is 15 m^2. I think there is something going wrong there when that is the case. I wonder if tracking is stable only within the bounds of the plane. But I am not sure about this...
     
  13. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    Hey guys

    Ok, I did a load of testing on IOS today... building different combinations of the elements we are using, specifically:

    Target Frame Rate
    ARFoundation Ver
    ARKit Ver
    IOS Ver
    Target Build IOS Ver

    .. I dont think these items are mutually exclusive when you look at how they are provisioned in the build and run on a device.. so it does make sense to me that they need to be married up.

    (Note: I am using scaled content... in ARFoundation... using scale of ARSessionOrigin)

    What I was hoping to identify was the crash @dyuldashev has been having and the tracking issues myself and @Edur-Games are having.

    @dyuldashev Re: The Crash going between non AR and AR Scenes...

    https://forum.unity.com/threads/multiple-ar-foundation-scenes-performing-poorly.571072/

    I wasnt having that on Android, but did have the issue on IOS after I upgraded the ARKit Package to v.16. (I was running 14). (Note: I did not try 15). The target IOS ver in build settings also impacts this.

    @Edur-Games I was having similar tracking issues to you on IOS.. floating objects and general jittering.. sometimes it was the entire camera render image jittering too.. not just the placed object. It seems to be a combination of ARFoundation ver and IOS ver. (eg. ver 19 is pretty bad on IOS 11 and 12)

    I wont detail ALL the combinations/permutations of versions I tried.. but the one that resolved 90% of issues is: (Testing on iPad 9.7 2017)

    > xCode 10
    > Target Frame Rate 60FPS (just popped Application.targetFrameRate = 60; in the awake function of an object in the AR Scene)
    > ARFoundation Package 18
    > ARKit Package 14
    > IOS device 12
    > Target IOS ver in build settings 12 (this does make a difference)

    You want to try that combo and let me know if its sorts things for you guys too.... Changing any one of these will introduce some form of the probs we are having. But having a stable build does allow us upgrade/change a single element to see what breaks.

    I am currently running > Unity 2018.2.6

    @dyuldashev I will keep this discussion here re: crash.. I know you've another thread going, so if this solves it, I have linked between the threads
     
    Last edited: Oct 21, 2018
    dyuldashev likes this.
  14. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    61
    This is a long thread, and thanks a lot for this amazingly helpful research. We know that it is not a complete fix for the bug, but, in my case, it's good enough for now. Here's what worked for me:
    - AR Foundation 1.0.0 preview 1.8
    -ARKit XR Plugin 1.0.0 preview 1.5
    -XCode 10..................iOS 11 && iOS 12 both worked
    -iPad 2017

    As for the jittery tracking, download a well known AR Kit app from the App Store. And try to see how it works in your environment. If a few of those apps are jittery as well, there is nothing to worry about. It just means that you have to place your content under acceptable lighting conditions.

    Also, I will try to disable planes from being generated, and I think it's causing a frame rate drop sometimes in one of my scenes.
     
    Last edited: Oct 21, 2018
  15. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    Thats good to hear.. I'll upgrade to ARKit 15 and target ios11 and confirm its good my end. Might point to crash being specific to Arkit 16.

    @dyuldashev what ver of Unity did you use

    Thanks
     
    dyuldashev likes this.
  16. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    61
    Unity 2018.2.11f1
     
    GreeneMachine likes this.
  17. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    61
    I think the issue with AR Foundation 1.0.0-preview 1.9 is the addition of the new Camera API. I don't think that they synced everything properly between AR Foundation and AR Kit when they added the new API. @tdmowrer, I saw that you were answering questions about the new Camera API, would you please take a look at this as well? Thanks.
     
    GreeneMachine likes this.
  18. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    Hey @dyuldashev I updated to ARKit 15 and appears to work ok targeting 11 & 12.
    The experience is still not perfect, but we're getting there.
    Thanks
     
    dyuldashev likes this.
  19. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    61
    I wonder which one is better in your case, 1.4 or 1.5?
    I have one more recommendation, but it might be very time consuming.
    You could try updating to the latest version of Unity to see whether it improves tracking or not:
    https://unity3d.com/get-unity/update
     
  20. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    @dyuldashev Yeah I think I'll upgrade unity next and test both ios and android builds.
    Im pretty good on android at the moment.. and ios has improved, but the object still doesnt anchor immediately when placed.. it floats for about 2-3 secs. Its not the content Im placing as I have tested with a simple cube. It did appear to happen when I introduced the code to turn of the plane manager. I will remove that and retest too.

    I cant debug in xcode at the moment as my cable is acting up.. i'll source a new one

    How is your build behaving
     
  21. ryaneugenekelley

    ryaneugenekelley

    Joined:
    Jul 8, 2015
    Posts:
    3
    @GreeneMachine I am experiencing the same floating for 2-3 seconds on iOS as well have you sorted this out ?

    Im on these versions
    ARFoundation - 1.0.0 - preview 1.8
    ARKit - 1.0.0 - preview 15
    Had to downgrade a version do to scene change bug in AR Foundation 1.9

    Unity 2018.1.9f2
    iOS Deployment target 11.0
     
  22. viktor_chernikov

    viktor_chernikov

    Joined:
    Oct 8, 2018
    Posts:
    10
    Have the same issue as well on latest AR Foundation plugin with latest Unity release (2018.2.14f at the time of writing)
     
  23. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    I never solved this loss of tracking for a couple of seconds on ios.. but it seemed related to disabling the PlaneManager.
    I intended on testing without disabling this manager.
    It appeared to be worse when I upgraded to Arfoundation 1.9, but that had its own tracking issues which may have just made the problem appear worse.
    During some tests I felt it improved when I targeted Ios 12.. but I had been doing alot of test builds so need to test this again.
    I am away at the moment so cant test until next week.
    Please post any updates if you test.
    Thanks

    Edit: Here was my original thread about this. A few devs have this issue.

    https://forum.unity.com/threads/managing-trackables.564217/#post-3777577
     
    Last edited: Nov 1, 2018
  24. JoeGrainger

    JoeGrainger

    Joined:
    Oct 20, 2012
    Posts:
    16
    Sorry to revive an old thread but it seems the loss of tracking is still happening in AR Foundation 1.0.0-preview 22

    If I relocalise to an existing AR World Map and then toggle the ARPlaneManager, my scene floats away and doesn't actually return to it's original position - instead it anchors permanently to a new incorrect position?
     
  25. AlbyDj90

    AlbyDj90

    Joined:
    Feb 7, 2015
    Posts:
    26
    Have you guys ever used the Reference Point? I had BAD tracking until i learn how to utilize this feature...now it works like a charm! I don't understand why i never found a tutorial that talks about this.
     
  26. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    @AlbyDj90 Interesting suggestion... can you elaborate on how/what you implemented? I'd be interested in giving it a try. I assumed that loading as asset via placeonplane gives it a reference point in session space that is tracked?(relative to any subsequent camera movements)

    Thanks
     
  27. AlbyDj90

    AlbyDj90

    Joined:
    Feb 7, 2015
    Posts:
    26
    I found a lot of help reading this Thread:
    https://forum.unity.com/threads/create-arreferencepoint.544356/

    In my workflow i use TryAttachReferencePoint for attach one reference point to the Plane detected by my device and then i put every gameobject as a child of this reference point.
    Give it a try! I wonder how people get a good tracking performance without this...
     
    GreeneMachine likes this.
  28. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    24
    I also faced this issue. The detected plane is not stable. But, when I place the object above the plane (maybe +0.01 units) the object is stable but the plane is not. When I place the object over the plane or below the plane both the object and plane are not stable. This is a strange behavior.
    And, also the plane is not over the surface, it is raised a little bit from the surface.
    Note: I'm not attaching the object with the plane, I'm using the plane to get the proper rotation.
    I'hv tested my project in both unity 2018.3.x and in 2019.2.x
    I'm using the latest version of ARCore and ARFoundation plugin. Still facing the issue.
    Please let me know if anybody has a solution.
     
    DrSharky, kittik and novaVision like this.