AR Using 3D Objects

Technology

Unity

Objective

The objective of this experiment is to create an Augmented Reality with 3D objects as the target.

Experiment

Create a Unity project, switch the platform to Android, and make sure to enable the Vuforia Augmented Reality engine in the XR Settings. Once everything is set up, insert the AR Camera and 3D Scan for the image target.

The Object Scanning Target

Scan your object using the 3D scan Vuforia app on android. Users will have to scan the object using the Vuforia object scanning target region (refer to the image above).

Place your object on the bounding box (refer to the image above). Once the object has begun to be scanned, the surface region will appear. Press record and start scanning the surface region. If the region has been scanned, the section will turn green. Keep recording until users record the majority of the region (refer to the image below).

Once the object are all scanned, stop recording and export the file (refer to the image below).

Upload the image on the Vuforia developer portal and export the database to unity package. Once it finishes downloading, import the file to unity, and set the image target to the package (refer to the image below).

After inputting the license key in the Vuforia Engine Configuration, users can begin inputting AR attributes to the surface. In this case, I created a cube inside the surface area.

Now users can test it out (refer to the image below).

I also incorporated the depthmask shader in this experiment. The depthmask shader draws faces which are invisible, but which still appear in the depth buffer. This allows you to prevent objects from being drawn where they are occluded by the mask. Objects using this shader will be drawn just after regular opaque objects. However, the shader will prevent subsequent objects from being drawn behind it.

I created a cube to resemble the box to insert the shader and moved the cube on top of the shaded cube.

The final experiment:

Challenge

The tracking was quite a challenge as a clear space is needed to achieve a more accurate tracking.

Conclusion

Although this experiment is quite basic, I hope to incorporate the 3D scan aspect of this experiment into my final project.

Leave a comment