Start a Project

What is Ar Model in Android

In this tutorial, we’ll be discussing Augmented Reality.

Overview

According to Wikipedia, ARCore is a software development kit developed by Google that allows for augmented reality applications to be built.

ARCore uses three key technologies to integrate virtual content with the real environment:

  1. Motion Tracking: it allows the phone to understand its position relative to the world.
  2. Environmental understanding: This allows the phone to detect the size and location of all type of surfaces, vertical, horizontal and angled.
  3. Light Estimation: it allows the phone to estimate the environment’s current lighting conditions.

ARCore is a Google platform that enables your applications to “see” and understand the physical world, via your device’s camera.

In our app/build.gradle file, we can add the dependency for Sceneform to update the project. Although we’ll be writing this tutorial in Kotlin, Sceneform uses some language constructs from Java 8, so we’ll need to explicitly add support since our minimum API is less than 26.

add project lable dependency

you need to set the ar plugin in your app’s Gradle file as well.
Add the following below the dependencies:

We need to permission for camera in Android Manifest.

Adding our Model

To make life easier, and to allow us to import our own 3D assets, we’ll also include the Sceneform plugin for Android Studio. You can install this by selecting preferences, plugins, browse repositories, and search for Google Sceneform Tools (Beta)

We can download the Google Sceneform Tools plugin in our Android Studio to view and render the 3d models.

You can go to https://poly.google.com/ and download a sample model. Don’t forget to credit the creator!

Typically, the OBJ and GLTX formats are used for rendering augmented images.

Now let’s build our first AR application where we’ll use the above 3D model as our AR image.

Now right click on app and create simple directory.

copy and paste all files that you download.

Then  right click on obj file and click on “import sceneform assets”

Let’s code

MainActivity class

 

Exit mobile version