NasimiAsl Posted August 3, 2016 Share Posted August 3, 2016 hi what is the best Solution for load a lot of obj and geometry (with texture) ? the main problems : when we wanna load all before start render a long time we most wait. when we start engine Animation and add Mesh with delay scene is lock a short time per each object have any thread for loading (buffering) in babylonjs? Quote Link to comment Share on other sites More sharing options...
chicagobob123 Posted August 3, 2016 Share Posted August 3, 2016 Create a counter. Use the timer callback code thats in a couple of examples. When the everything is loaded start the rendering. Quote Link to comment Share on other sites More sharing options...
chicagobob123 Posted August 3, 2016 Share Posted August 3, 2016 var timerId = setInterval(function () { if (AllLoaded) { clearInterval(timerId); return; } }, 250); Quote Link to comment Share on other sites More sharing options...
adam Posted August 3, 2016 Share Posted August 3, 2016 @NasimiAsl I'm not sure if I understand the issue, but are you using AssetsManager? http://doc.babylonjs.com/classes/2.4/AssetsManager Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted August 3, 2016 Share Posted August 3, 2016 The wait is impossible to avoid if you need the meshes to be ready and used right away i guess, just use manifests and hope the player doesn't clear his browser cache daily @chicagobob123 you don't need a interval, just call a function when the mesh is done loading. can also, rather easily, be edited to work with progressCallback's.. by checking if loaded amount equals the total size before doing progCount+=1; var progCount = 0, totalAssets = /* number of assets you're loading */; //load meshes.. //on last line of the import code for each mesh, finishedLoading(); function finishedLoading(){ progCount+=1; if(progCount === totalAssets){ //continue with whatever you need to do next.. } } Edit: Also, if using the AssetsManager you can skip above code completely and use the assetsmanager's pre-made function that is called when all meshes have been loaded.. I can't recall the name of it though. Quote Link to comment Share on other sites More sharing options...
chicagobob123 Posted August 3, 2016 Share Posted August 3, 2016 Would that loop block the loading? Wouldn't you need a sleep or something to allow the background loading Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 3, 2016 Share Posted August 3, 2016 i always try to minimize things, in the end only values running trough switches 1 for on 0 for off : 1 0 0 1 1 var a var b+=a var c +=a a( load b(obj) render) user-input a( load c(obj) //lag render) Best Solution For Loading ? Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted August 3, 2016 Author Share Posted August 3, 2016 i wanna have step loading without any latency for render i watch the mesh loading the geometry load is fast but the texture (even when that load from IndexedDb ) the requestAnimationFrame function wait to complete the texture loading when the mesh have 10 or more texture you have big latency in step loading how can buffer texture without latency ? this can be help to make soft step loading i think may be i am wrong at all i don't know Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted August 4, 2016 Share Posted August 4, 2016 @NasimiAsl i'm not sure, one way to "fix" it you could set the meshes isVisible = false; and when it's fully loaded set it to true.. atleast it won't show up without textures and if it's made out of several meshes it won't show up in bits as they get loaded. and perhaps looking into pre-loading the textures could work.. load textures as babylon.js textures before you start loading the meshes and then set the textures as the meshes gets loaded.. dono.. does sound like a lot of work though but thats the two ideas i've got, hope you figure it out NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 4, 2016 Share Posted August 4, 2016 @NasimiAsl I got a project and i already pass the deadline since 2weeks. Not only Textures also be also thoughtful, where you import a newMesh, and how, this affect Babylonjs http://www.babylonjs-playground.com/#11MKSY#1 Interesting question! Maybe i catch up later! Hope you find a solution, that fits in your Project EDIT@NasimiAsl 2Weeks behind my Project.http://www.babylonjs-playground.com/#11MKSY#2 Best NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.