Skip to content

AR Viewer Android App built with Unity. View 3D Models (.obj, .gltf, .glb) in AR and generate WebAR links for .gltf/.glb models to view in Web Browser.

Notifications You must be signed in to change notification settings

sushanthjambu/unityarapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AR Viewer Android App (Unity)

  • An android app made with Unity that can import 3D models (.obj, .gltf, .glb) present on the device and display them as an AR object after tapping on the detected ground plane.

Obj Import

  • Generate Web links that can display the selected 3D model (only .gltf and .glb files are supported for this feature) as an AR object in Web Browser. These links can be shared with anyone so that they can view the AR content on their browser.

    Note : If the browser or the device doesn't support AR then only the 3D Model is dispayed.

WebAR URL

  • Export the imported models to a location on your android device as .gltf model. So you can first import a .obj object view in AR and then export it to a location on the device as .gltf model.

    Note : The exported model may not contain all the textures/features of the imported model. The app is limited by the libraries/packages it uses.

Export

Features

There are two main features that this app implements

  1. Imports the local 3D files of type .obj, .gltf and .glb and displays in AR View.
    • After placing the object on a plane you can also export the 3D object to .gltf format. However the exported object may not have all the properties of the original object.
  2. WebAR - Generates a Web link which can be shared. So that anyone can view the 3D object in web browser for which you have generated the web link.

Installation

  • You can find the .apk file in the releases section that can be installed on your Android phone. But the WebAR feature will not work this way, read the WebAR section below to know more.
  • You may clone this repo or download the zip and open it via Unity Editor. You can also run/play the project in Unity Editor.

Unity Version and Packages used

  • Unity - 2020.1
  • AR Foundation - 3.1.10
  • AR Core - 3.1.8

Some of the external packages used are

AR Viewer

  • You may click the "Browse" button on home screen.Also you can open the Options Panel by clicking the button on top left and then click on AR Viewer button.

    Browse button

  • After that select the appropriate 3D File to view in AR.
  • Sometimes the importer may throw an error or the textures are not imported properly. The app just uses external packages for importing hence nothing can be done in these cases.

WebAR

  • Implementing WebAR is not direct. You must also implement the Server side funtionality for this to work.

Obj Import

Working of feature

  1. The app uploads the user selected file to a remote server. In my case an Amazon S3 storage bucket.
  2. After successfull upload the server stores the file's S3 storage location in database. Later, a WebAR link is generated by the server.
  3. When this link is opened in the browser, the server renders a html file that uses Model Viewer to display the object in AR.
  4. So the server gets the uploaded 3D file from Amazon S3 while rendering html in browser.

Steps to upload the file/folder successfully

  1. User can select either a .glb file or .gltf file. If the .gltf has supporting files like .bin or texture images in a folder, then user must upload the folder containing all the supporting files.
  2. However the cumulative size cannot exceed 50MB limit. You may change this in FileUploader.cs to suit your needs.
  3. To select a folder, open the folder you want to upload and without selecting any file in that folder just click on "Upload" button. Make sure the folder name is present in the Address bar before you upload.

Obj Import

  • Open the folder you wish to upload and check if the folder's name is correct in the address bar.
  • Next Click on Upload, the last name present on Address bar is the folder that will be uploaded.

Steps to implement the Server

Credits

About

AR Viewer Android App built with Unity. View 3D Models (.obj, .gltf, .glb) in AR and generate WebAR links for .gltf/.glb models to view in Web Browser.

Resources

Stars

Watchers

Forks

Packages

No packages published