Search Unity

ARFoundation Plane detection: Marker does not find planes correctly. Won't snap back to floor

Discussion in 'AR' started by Lepisto3D, Oct 28, 2019.

  1. Lepisto3D

    Lepisto3D

    Joined:
    Oct 6, 2019
    Posts:
    27
    Hi,
    I'm having issues with the plane detection taken from this sample project.


    I've posted in both these threads where it seems people are having similar issues, but no solution for me yet.
    https://forum.unity.com/threads/pla...h-arfoundation-2-1-0-mostly-on-iphone.688432/
    https://forum.unity.com/threads/ar-foundation-continously-update-position-of-gameobject.622090/

    My marker jags, spazzes around and lags for 1-2 seconds when starting my AR session but when it finally locks on and finds a surface it's all ok. Then, when I proceed to move the marker to the table, it slowly after 1-2 seconds finds the table surface but then it will not snap back to the floor when I point the camera back at it. It's like it creates an endless, infinite plane from the table surface height level, and there's no edge where the marker will drop down and find the floor. When I lower the camera "through" this level, it finds the floor again.

    This ONLY happens on my iPhone X (both iOS 13.1 and 13.2 - just installed 13.2 to see if any difference. nope)
    My programmer builds the exact same project onto his Samsung Galaxy A8 and the marker works completely different. It does not jag before finding the floor, although it does it slower - fair, considering it's a slower, older phone, but it does not jag about and lag. It easily finds the table and easily snaps back to the floor.

    I have tried building on 2019.2.4f1 and 2019.2.9f1. I tried updating to ARFoundation 3.0.0 preview4 but no difference. We're on ARFoundation 3.0.0preview2. The subsystems and ARCore + ARKit also with the same version of course.
    It might be a good idea to tell you that I've taken the ShaderCompiler from 2019.3 beta and replaced mine in 2019.2.4f1 since there was a known issue that it would not compile shaders in macOS Catalina. Probably not related, but might be good to know.

    I tried playing around with the Detection mode (Horizontal, Vertical, Everything) in AR Plane Manager script but no difference.

    In the other threads people suggest it's something with the frame rate.
    They also suggest to play with the settings in the Tracked Pose Driver, but this isn't used in our project? It uses the AR Pose Driver script on the camera instead, without any selectable values/options.

    Here's a video where I test it.
    https://drive.google.com/open?id=1wGXUGLkd1rayOKuVpxMo3VtWVWXBfO9h
    Notice how when I move my phone quickly around, before the marker seems to "settle down" at 0:12, it snaps between the two surfaces up and down without problems, just jagging about a bit. Eventually it settles down and works slowly from the floor, finds the table, then does not want to return to the floor.

    I hope I'm being clear enough. I'm running out of ideas and this is very frustrating. What is wrong?
     
  2. unnanego

    unnanego

    Joined:
    May 8, 2018
    Posts:
    199
    Same here. I think it has always been like this or at least it's been like this for a long time.
     
    Lepisto3D likes this.
  3. Lepisto3D

    Lepisto3D

    Joined:
    Oct 6, 2019
    Posts:
    27
    I saw your reply in the other thread.
    At least we are two with the same problem.

    It’s weird, it’s clear in the video that I linked that it does not happen for him, but it does for us.

    One thing to note for others who read this; the project that I downloaded with the plane was for an older version with arfoundation so my programmer changed it a bit to work with 3.0.0. But it keeps acting weird.

    I suppose you also remade the project to make it work with a newer version, unnanego?
     
  4. unnanego

    unnanego

    Joined:
    May 8, 2018
    Posts:
    199
    It works like this out of the box since 1.5 at least. It definitely does so with all 3.0.0 previews

    Actually, I just got an idea, can't test it right away, but do you use ARPlaneManager.SetTrackersActive?
    Because a couple of hours ago we were testing and when we had visualized planes of the table, the chair and the floor it worked as intended. Maybe try scanning more? Moving slower?
     
  5. Ghus86

    Ghus86

    Joined:
    Oct 24, 2013
    Posts:
    15
  6. Lepisto3D

    Lepisto3D

    Joined:
    Oct 6, 2019
    Posts:
    27
    Hi, i've been offline for a while. I've not had the opportunity to catch back up with this yet but I will update you as soon as I get the chance.

    The scanning more and moving slower method does not work, no difference I'm afraid :/.

    I will look into this and will try with different versions (1.5 and lower). My client just needs to respond to my phone calls :D I'll update you as soon as I get to try it
     
  7. unnanego

    unnanego

    Joined:
    May 8, 2018
    Posts:
    199
    In the other topic someone from Unity said that it's because you should target Planes.PlaneWithinPolygon when doing the ARRaycast
     
    om3l3tte likes this.
  8. Lepisto3D

    Lepisto3D

    Joined:
    Oct 6, 2019
    Posts:
    27
    Hi unnanego

    did you solve this yourself?
    I checked the thread yeah I saw that comment.

    My project has been on pause for almost half a year now. I should be able to get on with it very soon and I will try that.
     
    unnanego likes this.
  9. unnanego

    unnanego

    Joined:
    May 8, 2018
    Posts:
    199
    yes, I have, this solves it. It pretty obvious, actually - if you set it to "Infinity", it will give you an infinity of the first plane it finds, so don't use this one, if you want more than 1 level
     
  10. Lepisto3D

    Lepisto3D

    Joined:
    Oct 6, 2019
    Posts:
    27
    Awesome I will try it asap and update you with the result
     
  11. Lepisto3D

    Lepisto3D

    Joined:
    Oct 6, 2019
    Posts:
    27
    How did you set this setting? I'm on it right now. Did you just comment out row 125, 126 in the ARPlaneManager script?
    This is 3.0.0

    This row
    Code (CSharp):
    1.                     if ((trackableTypeMask & TrackableType.PlaneWithinInfinity) != TrackableType.None)
    2.                         trackableTypes |= TrackableType.PlaneWithinInfinity;