how to align 3d model in real world

I am trying to align my previously built model with the real world. Like, making a white ball to be earth while using AR app on an ios device. How can I do that? Any help would be good!

Replies

There are multiple ways to achieve this. The fastest way is using RealityComposer. You can try it out by creating a new Xcode project using the "Augmented Reality App" template and selecting "RealityKit" as content technology. This template runs an AR experience that displays a cube anchored to a real-world plane. When you open the experience in Reality Composer, you can replace the sample content with your own model.

You can also perform this in code by running an ARSession using plane detection and adding your virtual content as an Entity (if you use RealityKit) or SCNNode (if you use SceneKit) at the location of a detected plane. The Xcode template mentioned above will display the object on the first horizontal surface that's detected when launching the app. If you want more control over the location where the object appears (for example have the user tap the screen to choose the location), you can use raycasting to determine the coordinates where to place the object). If you're new to ARKit, I recommend checking out our developer samples. One sample related to placing objects you can find here: https://developer.apple.com/documentation/arkit/environmental_analysis/placing_objects_and_handling_3d_interaction.

It’s a difficult problem of robot vision, computer vision, machine vision, computer graphics, …

You have made a model. It must have shape, size, position, orientation. You like to attach it to a real object surface. Also the real object surface has shape, size, position, orientation.

How to align your model to the real object surface front of you is a problem not solved cleverly yet last 60 year since the invention of robot.

Last night, I have captured a video. Virtual cylindrical models are attached to real object surfaces.

YouTube: X2CPx9zuxZ0

The source code of the App is available on GitHub CurvSurf

FindSurface-SceneKit-ARDemo-iOS (Swift)

Another example of aligning 3D models to real object surfaces.

YouTube: BmKNmZCiMkw

Once we know the shape, size, position, orientation of an object surface, we can render virtual object models/videos on/around it.

Tools used:

  • iPhone 12 Pro
  • Apple ARKit
  • Apple SceneKit
  • Apple Metal API
  • CurvSurf FindSurface runtime library.