Now I have the remote download link for our gLTF model I can load it on app launch. I’ve branched off of my AR Demo Repo I used when I wrote “Build your first Android AR app with ARCore and Sceneform in 5 minutes”.

Lets grab the latest version of Sceneform in our app’s build.gradle file and include the new assets library.

implementation "com.google.ar.sceneform.ux:sceneform-ux:1.5.0"

implementation 'com.google.ar.sceneform:assets:1.5.0'

And don’t for get about updating our top level gradle file.

classpath 'com.google.ar.sceneform:plugin:1.5.0'

Now swapping into the MainActivity.kt, we can replace our asset name with the new url we retrieved earlier.

addObject(Uri.parse("https://poly.googleusercontent.com/downloads/0BnDT3T1wTE/85QOHCZOvov/Mesh_Beagle.gltf"))

Then we need to modify the placeObject() method to handle our remote resource.

And it’s as easy as that! After a short delay the model is successfully retrieved and added to the scene just as if it was bundled locally with our app.

Downloadable Doggie

The only downside of this approach is that so far I can’t see anyway to control the size of the model that has been downloaded. As you can see the model above takes up a significant amount of space, a solution to this would either be hosting smaller models in general or giving the user more control over scaling the model.

Update: Thanks to Tim Psiaki for pointing out the setScale() method in RenderableSource to solve the above problem.

I think this new addition to Sceneform opens up a lot of doors for developers, now that we can host our 3D models we won’t need to ship bloated APKs and be able to serve these models only if and when our users need them.

If you want to check out this code there’s a feature/fetch-model-remotely branch on this repo you can play around with.

Also if you have any questions or comments on this post or anything at all AR related feel free to reach out to me on Twitter, cheers!