I’m creating JS-script for 3d web configurator. I’m just learning three.js and need to some help and advices. Can enybody help me? I have two problems now.
How is it more efficient in terms of performance to add and remove large 3d models on one scene.
The same question applies to complex textures and materials that will be dynamically added and removed from models.
How best to store many models that will be dynamically added and removed to the scene. Will it be possible to store them all in different GLB files, then extract only objects from the GLB file and insert them into the scene. How correct is this approach?
Hi, welcome to the forum!
Im not entirely sure what the purpose of the generator is. It loads 3D models and then disables their visibility?
As far as your GLTF question goes, it depends on your app. You generally only want to load models, which are required, for example it wouldnt make sense to load 5 big levels in a game, but rather only the next one (and dispose of the previous one?) once the player finishes one. Otherwise you’re wasting memory and making the user wait unnecessarily long, because you are loading more than you need to.
On the other hand, if you know, youre going to use all your models immediately, it’s best to load them all at once, preferably packed into one file to avoid multiple http requests.
And yes, on the web its best to use the binary file formats for your models (egg.:
.glb), whenever possible. Engines like Unity optimize your assets during the build process. In the browser, you have to do it yourself.
I’m sorry, it was mistake. I meant 3d configurator which will allow you to represent complex 3d objects and replace various parts of objects, change textures, materials through the web interface. There can be a lot of objects in the scene, and therefore I need to find the best way to store and add them to the scene for performance.
If you store objects in GLTF, then one of the problems is that the GLTF file stores information not only about the object, but also cameras, lights, and so on.
This means that each time the object itself must be retrieved from the GLTF file via the .ObjectLoader method when adding a new object to the scene. Wouldn’t this create additional overhead when importing objects into the scene when the user selects them in the interface?
If you store objects in GLB format, then you also need to first retrieve the object through .ObjectLoader, then just add it to the scene. In this case, the conversion from binary format is likely to occur additionally.