1
votes

I'm trying to find the best strategy to align a SCNScene to a physical table. Just like the ARKit app WWWFreeRivers.

enter image description here

Currently I'm just testing out to map a simple plane model, with the same dimensions as the table. If I draw out the plane that ARKit detects, I can see that the plane is not very accurate with the edges. They always go outside of the edges (image below).

enter image description here

So I can't really rely on that plane, to just place the model in the center of this. The model is not rotated correctly either (image below).

enter image description here

I had another idea to use the ARReferenceImage technique, to take a picture of the table top texture, and let ARKit find and match this "image" of the table. But even with wood grain texture, it wasn't enough data for ARKit to recognize it. And ARKit just fails if you have these errors. It doesn't even try to do a bad match.

enter image description here

How can I go about doing this?

Ideas I've had so far:

  • Take image of table and use ARImageReference feature to match it. This didn't work. Maybe if I add some more interesting feature points to the table, like some sort of QR codes in the corners.
  • Detect the plane, and then tap the four corners on the table to map out a square, and use this.
  • Do as the WWW app, just place the object randomly on the plane, and then let the user scale, move and rotate the model to give it correct placement.

Any more ideas? What do you think will be the best approach to this?

1
Question. Are you trying to align models with that particular table? Or any table in general?pj_mukh
@pj_mukh For this particular table (the end result will be on another table, but it will only be one, which we have control over). This is why the ARImageReference technique could have worked.eivindml

1 Answers

2
votes

Two options I can think of you could use.

  1. You could create an ARWorldMap (iOS12+ only) and use it instead of the ARImageReference, walk around the area while creating a map that subsequent ARKit Sessions will remember. You can experiment slightly as to how to fit your models within the four corners of the table (this is slightly tedious w/o much help from the SceneView editor). However, when you load the saved ARWorldMap and localized against it (just like the ARImageReference), your model should fit within the four corners of the table every time.

  2. If you use something like Unity (and its ARKit plugin), it has much more powerful Editor tools (3D viewer/designer). There are some tools that can help you save the map just like ARWorldMap but then bring in details of the map into the editor so you can line things up right really easily. Placenote's Spatial Capture toolkit can help here. Placenote (iOS11+) creates its own "World Map" but it exposes the visual details in the Unity editor, making it easier to line things up and then localize against (Example). The map is also stored on a managed cloud from the get-go to make sharing across phones much easier.

P.S: Both these options require you to keep the environment generally static (not large lighting changes etc.), though this was a similar constraint to when using ARIMageReference.