googlesamples / arcore-depth-lab

ARCore Depth Lab is a set of Depth API samples that provides assets using depth for advanced geometry-aware features in AR interaction and rendering. (UIST 2020)
https://augmentedperception.github.io/depthlab/
Apache License 2.0
780 stars 153 forks source link

[Question] Collision Detection object placement #22

Closed RGregat closed 3 years ago

RGregat commented 3 years ago

First of all, this is a very impressive collection of different use cases for the Depth-API. In particular the localized depth examples are very interesting. I'm developing with ARCore and still "Sceneform" and therefore I'm using a traditional way to place anchors by a hittest and processing the hitresults. That is working great, but there are areas where it is not possible to retrieve a hitresult, or it is just a pain in the until something is returned. Exactly for that I adopted some ideas from Oriented 3D reticles and Collision checking for AR object placement. So far it is working but I'm not very satisfied with the anchoring. I'm using the session to create a anchor based of a Ray, which is a result of the Depth computation I made. The problem is, that the anchoring is not very stable and tend to move with the camera. If I compare the anchroing of the Collision checking for AR object placement** example it feels more solid to me. So I'm not a Unity guy and I have some difficulties to understand all pieces of the written code.

ruofeidu commented 3 years ago

Thank you Robert for your interests in DepthLab!

You are right, our anchoring may be more stable than the ARCore traditional anchors.

How is the anchoring of the object achieved

In the oriented reticle and collision checking demo, the algorithm anchors a virtual object to a vertex in a 3D space; and we used a low-pass filter on the reticle / object to make it more stable. Traditional anchors only rely on RGB features, which runs on lower-end phones that do not support depth.

Has someone a workaround to get a more stable anchoring

I don't have a quantitative comparison between the two solutions though, you may choose either way that works best for you :) The key API of our anchoring is https://github.com/googlesamples/arcore-depth-lab/blob/master/Assets/ARRealismDemos/Common/Scripts/DepthSource.cs#L367

Cheers, Ruofei

RGregat commented 3 years ago

Hello Ruofei, thanks for you response. I will take a look into the mentioned file. I did on Friday a small test, where I placed on the ARCore Session several anchors every 2 meter based on the results of the Depth API. The result was promising, I hit almost always 2 meters at the end.

ruofeidu commented 3 years ago

Glad to know that! We recently released new updates, please feel free to check it out: https://github.com/googlesamples/arcore-depth-lab/releases