Spectrum Club


ashish12 profile image Ashish kumar panda ・3 min read

Hello Everyone,
This post is going to be an interesting one because this is how i created my own pokemon(pikachu).What if we can create an app that can show us our favourite character,so it can be done by a simple addition of augment reality to our android app.



Alt Text
Augmented reality (AR) is an interactive experience of a real-world environment where the objects that reside in the real world are enhanced by computer-generated perceptual information, sometimes across multiple sensory modalities, including visual, auditory, haptic, somatosensory and olfactory. AR can be defined as a system that fulfills three basic features: a combination of real and virtual worlds, real-time interaction, and accurate 3D registration of virtual and real objects ~~(WIKIPEDIA)

in simple words pikachu in pokemon go,you can create it:)

so As an android learner how to implement this in our app,


1)install your app in a device that supports google arcore

2)uses-permission android:name="android.permission.CAMERA"
add this in a tag for asking the user to allow camera

3)Now after this add the following dependencies in your (app-
level)build.gradle file
implementation "com.google.ar.sceneform.ux:sceneform-ux:1.5.0"(use the supporting version or the errors will blow your mind) and
dependencies { classpath 'com.google.ar.sceneform:plugin:1.5.0'}(in project level build.gradle file)

this will add sceneform sdk to your project and also allows to implement different 3D assests to your project.you can download them from the internet or you can follow this link
remember to download the .obj file that is your actual model

4)now create a sampledata directory and add your assets there.
Alt Text

5)Add a fragment to your main layout.xml file
fragment android:name="com.google.ar.sceneform.ux.ArFragment"




i.e. the sceneform fragment.

Another important thing the sdk requires Api level-27 to run this or more so keep this in mind while creating the project(if your phone has inbuilt ar you're lucky my friend)
Alt Text

Next, we are using the ModelRenderable class to build our model. With the help of setSource method, we load our model from the .sfb file. This file was generated when we imported the assets. thenAccept method receives the model once it is built. We set the loaded model to our lampPostRenderable.

After all this thing you need the java code to run your first ar app.So here i am going to discuss about a few terms that i found confusing while implementing the code:

a)Scene: This is the place where all your 3D objects will be
rendered. This scene is hosted by the AR Fragment which
we included in the layout. An anchor node is attached
to this screen which acts as the root of the tree and
all the other objects are rendered as its objects.

b)HitResult: This is an imaginary line (or a ray) coming from
infinity which gives the point of intersection of
itself with a real-world object.

c)Anchor: An anchor is a fixed location and orientation in the
real world. It can be understood as the x,y,z coordinate in
the 3D space. You can get an anchor’s post information from
it. Pose is the position and orientation of the object in the
scene. This is used to transform the object’s local coordinate
space into real-world coordinate space.

d)** AnchorNode** This is the node that automatically positions
itself in the world. This is the first node that gets set when
the plane is detected.

e)TransformableNode: It is a node that can be interacted with.
It can be moved around, scaled rotated and much more. In this
example, we can scale the lamp and rotate it. Hence the name

         i hope now you can jump into the code https://github.com/Ashishkumarpanda/AR/blob/master/MainActivity.java)

IT consits of the following parts:

1)build the model
2)add your model to scene

Alt Text

hope this article will be helpful:)

Posted on by:

ashish12 profile

Ashish kumar panda


FREE ELECTRON.............

Spectrum Club

Our club “SPECTRUM” is based on robotics and software development by learning and collaborating on various projects of different domains.


markdown guide

Nice explained..but do mention the fact..sceneform is discontinued by google and officially this can be done with google AR CORE. If you still prefer sceneform use Android studio version 3.5 or below...else it won't work..


I forgot to mention the studio version. Thanks for the info. 😊