Displaying dynamically generated scenes using AR Core

I’m adding AR capability to an existing application that generates parametric models (for context https://gardenroomplanner.com). The idea of implementing this is quite simple:

  1. take the scene and export it using GLTFExporter
  2. upload the exported file to a server
  3. use google model-viewer to display the model and allow the user to switch to the AR mode using the native AR functionality ARCore/QuickLook based on the platform

This naive approach worked in principle. So far, I’ve tested it on Android. Displaying of a substantial portion of exported scenes there however fails at the point when I try to activate the AR. I get an unhelpful error “Couldn’t load object. Looks like there’s something wrong with this object”. The models are dynamically generated, there is no chance to validate them ahead of time.

I found that by following these rules, I can substantially increase the changes of the model working. They are no brainers but will mention them anyway:

  • Keep the total file size small (I read somewhere that the limit is 15MB)
  • Only export what’s needed, filter out any unnecessary objects from scene
  • Fix errors reported by GLTFExporter
  • Fix errors reported by GLTF Validator

Even after the above, a portion of models fail to display. My question are:

Is there any way to validate models specifically for AR Core and get the specific errors?
Could anybody share tips on what typically causes problems in models and what should be avoided?

I do realize that some of the points made here are a bit vague but I’m still hoping to get some directions based on that…

ideas: find a model that breaks it, and then reconstruct it one step (poly? quadfan?) at a time. download the models and inspect them with spector or vscode on a PC. instance primitives instead of creating new meshes. you can use renderDoc on android to trace the render steps. use ‘logcat’ on android to look for errors in the android console.

1 Like