3D models in Android Augmented Reality SDK

The Augmented Reality SDK provided by Catchoom allows you to render 3D models into the AR scene. Those models can come from:

  • the online web content creator and downloaded automatically once the object is recognized
  • embedded into your app and loaded programmatically at runtime.

For both options, the Android Augmented Reality SDK provides means to control the loading process. Read below about how to:

model_on_android_programmatically

Load 3D models from CraftAR Service

Inside the online web content creator of CraftAR, you can add 3D models to the AR scene. Once an object is recognized, the SDK starts downloading all the contents that you set online. Once downloaded, all contents in the scene are loaded automatically by the SDK, including 3D models. This process has three steps and we provide feedback of their process through the SDK.

These are the three steps taken to load 3D models in the SDK, once the object (item in the service database) has been recognized:

The SDK provides an interface to track a model’s load progress and status. A handler can be set to the 3D model contents that will receive these updates:

With this interface, you can get updates for the following events:

In order to add the handler to your 3D model content, you need to traverse the contents in your item. This example shows how to do this:

Load 3D models embedded into the app

To add 3D model contents on top of the reference image programmatically is as easy as creating the 3D model with the name of the model stored in the resources of the application.

The following lines show how the content is created for a 3D model called “pizza.obj”:

In this case, the model has been added to the project inside the res/raw directory. The Android SDK takes care into copying resources in this folder to the external storage, if available.

Note: Eclipse is very restrictive about file names in the res folder. If you find issues adding your models there, you can compress them into a file named resources.zip. The SDK will uncompress that file when the application is ran for the first time.