This video shows the steps to create AR (Augmented Reality) Android app by superimposing your own 3D model image on camera view.
In this video it shows the below steps:
1 Create GLTF file
2 Put the file in your GitHub public repo
3 Update the Android code
The Android code in this video is referred from the below page:
https://developers.google.com/ar/develop/scene-viewer#java
For creating the GLTF file, in this video it first created the GLB file using the Paint3D and then converted it into GLTF using converter tools.
The sample model used in this demo is available in the below URL:
https://raw.githubusercontent.com/programmerworld1990/3DModelFiles/main/Test3DModel.gltf
The App is published in play store at the below link:
https://play.google.com/store/apps/details?id=com.programmerworld.arappwith3dmodel
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Complete source code and other details:
package com.programmerworld.arappwith3dmodel;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void buttonARView(View view){
Intent sceneViewerIntent = new Intent(Intent.ACTION_VIEW);
sceneViewerIntent.setData(Uri.parse("https://arvr.google.com/scene-viewer/1.0?file=https://raw.githubusercontent.com/programmerworld1990/3DModelFiles/main/Test3DModel.gltf"));
sceneViewerIntent.setPackage("com.google.android.googlequicksearchbox");
startActivity(sceneViewerIntent);
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ARAppWith3DModel"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="152dp"
android:layout_marginTop="36dp"
android:onClick="buttonARView"
android:text="Start AR View"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Model files (GLB and GLTF) are available at:
https://drive.google.com/drive/folders/1CHGMxjA84boXS4b2O8tlfn2SKrdYveHt?usp=sharing
Screenshots:
In Emulator it is not supported:
In Real device:
Complete project can be accessed at the below link after the payment of USD 9:
https://drive.google.com/file/d/1Z9–uOmBgqtF_h8pSMwV-50EyjfnLjAH/view?usp=sharing
Excerpt:
In this video tutorial, viewers are guided through the process of creating an Augmented Reality (AR) Android application that overlays a 3D model onto the camera view. The key steps include:
- Creating a GLTF file from a GLB file made in Paint3D.
- Hosting the 3D model on a public GitHub repository.
- Incorporating the 3D model into Android code based on Google’s Scene Viewer documentation.
The tutorial provides the Android application source code, available XML files, and showcases how the app functions in a real device as opposed to an emulator, which does not support AR. Additionally, the demo’s 3D model is shared for reference.
The app developed during the tutorial has been published on the Google Play Store. Viewers can find the complete source code, screenshots, model files, and the entire project, with the latter being accessible upon payment. Contact information is provided for further questions and suggestions.