Home › Forums › Programming › Append multiple scenes with callback
- This topic has 4 replies, 3 voices, and was last updated 8 months, 2 weeks ago by kuze.
-
AuthorPosts
-
2021-07-23 at 3:41 pm #43145webCustomer
Hey guys,
I’m working on a bigger project where I started to split the scene into different parts. This way its easier to update specific parts, and multiple people can work on the project.
At the moment I’m loading one part and on load I append the remaining scenes. This works great, but I would like the preloader to finish when all scenes are loaded/appended.
I tried putting the appendScene into the “prepareExternalInterface” but that doesnt seem to work.
Anyone got an idea?
2021-07-23 at 4:56 pm #43147xeonCustomerHey there,
So you have a large project that you have broken into several parts to make it easier to work on. Thats a good thing.
Most browsers are limited to 50Mb some even less unless you are using a customized version of Chromium. So if the combined gltf, bin and textures of all your files exceeds 50MB…then odds are it just wont load for many devices and just time out. Depending on your needs this may or may not be a problem. To avoid this you would want to keep your project in small chunks and load in only what you need when you need it and dump out of memory stuff you don’t need. But I am sure you have already thought about this.
Based on what I understand, you want to pre-load all your scenes and have the pre-loader monitor the loading of those scenes and associated assets. Since you are aware of the limitations of browser memory then the combination of all the files would be something less than 50MB. So in this situation from a performance standpoint, it might be more efficient to re-assemble all your assets back into one scene and not do the appends.
However, if it is not a concern you will probably need a custom-coded pre-loader, not the default preloader in Verge Puzzles. This could be done all external or done in Blockly and create a new preloader puzzle. It will need to monitor the available memory the browser can store, validated it against what you are trying to download into it to see if it will fit. If it can fit, download all of it. If it cant fit…check to see if it has enough space to download just the main scene. If not fail gracefully, if ok, use the puzzle logic to load and unload as needed rather than all at once. Its a complex problem that will affect your project from a coding standpoint and from a puzzle standpoint.
What we have found to be a simple approach is to make the main scene just a scene loader/unloader…very minimal 3d assets. Yes, this means the preloader puzzle will zip by quickly. But then you can create your own simulated loader bar using the append puzzle and the optional “enable on progress” and create your own progress bar inside of verge. You could design it to even look like your prelaoder page if desired. This option gives you great flexibility into controlling loads without custom code.
Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2021-07-26 at 1:44 pm #43245webCustomerThx for your detailed explanation. I managed to find pretty simple “hack” without two much rewriting.
I moved the “app.run()” from the “app.loadScene()” into the finish callback from the appendScene(). This way the standard preloader waits until the last appendScene is finished. Tiny drawback is that the progress bar doesnt take all the scenes into account, so the bar jumps to start everytime a new scene is loading. But this approach works with minimal effort.
2021-07-26 at 3:23 pm #43254xeonCustomerNice….well done.
Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-04-09 at 8:58 am #72193kuzeCustomerHi Web,
I moved the “app.run()” from the “app.loadScene()” into the finish callback from the appendScene().
Did you modified it in MyApp.js file?
Can you send me an example of your modified code, please?Thank you
-
AuthorPosts
- You must be logged in to reply to this topic.