"Preload" GLB Model

I’m currently “bringing in” the model file with modelFile = require(/path/to/glbfile) and then on a touchstart event, loading using GLTFLoader: load(modelFile)

I’m new to Three, but what is the best practice for this scenario? When you want to first load the model, but only after the initial touchstart event. Is there a concept of “preloading” the model? Can you load the model offscreen when your app first starts and then “show” with touchstart? Are there any speed/performance concerns?

It sounds like you’re using some bundling system? require() wouldn’t work with a .glb file otherwise, and if so the answer probably depends on what that system is.

Normally, you’d do GLTFLoader.load('path/to/file.glb'), and only call that function when you’re ready for the model to load. You can call it as early or as late as you want. Doesn’t really matter when, except that if the model has large textures, the app may freeze for a few frames while the textures are uploaded to the GPU. Some users avoid that by rendering one initial frame before they hide the loading bar, for example.