juanmajr93 Posted December 16, 2016 Share Posted December 16, 2016 Hi, I have many questions of the my scene. The first problem that I would have to solve is add more time to symbol (loadingscreen). I load many obj (number of total mesh:300) and I would like that the user couldnt see anything until all buildings whith their textures had been loaded. Other strange problem is the follow. Sometimes while all objects are loading, firebug console shows this error: "image corrupt or truncated". What can be the cause? (It is not always) Finally, when I try to probe in Chrome, the scene start to load well but when some seconds spend all my screen is white. After I try to reload website, It says me: "WebGL has detected an error" Thanks you very much. Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 16, 2016 Share Posted December 16, 2016 Hello, For the first question, you can use scene.executeWhenReady( callbackfunction); the function callbackfunction will be called when everything is loaded and ready to be displayed on screen. Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted December 16, 2016 Author Share Posted December 16, 2016 If I use this function what must be callbackfuntion? ... I have tested the next code but loadingScreen doesnt appear on my screen engine.displayLoadingUI(); scene.executeWhenReady( engine.hideLoadingUI()); Also, I have done a test with logs and this function is called so fast, I need more time to load models and apply texture... (The solution is that appear a loadingScreen for this time) JuanMa J.R Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 16, 2016 Share Posted December 16, 2016 Hello this is correct but you have to initiate meshes loading before. executeWhenReady will call your callback when all meshes ill be downloaded Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted December 19, 2016 Author Share Posted December 19, 2016 Hi again. Thanks Detakosh, I got it however, this function is called before mtl files are applied. Do you know any way to wait after materials with textures have finished? JMJR Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 19, 2016 Share Posted December 19, 2016 engine.displayLoadingUI(); scene.executeWhenReady( engine.hideLoadingUI.bind(engine)); Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted December 19, 2016 Author Share Posted December 19, 2016 Temechon I have test this function, It is well but the problem is that loadingScreen doesnt appear. Before loading models I have these lines: var assetsManager = new BABYLON.AssetsManager(scene); assetsManager.useDefaultLoadingScreen = false; engine.displayLoadingUI(); Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted December 19, 2016 Author Share Posted December 19, 2016 Hi again, I have checked differents solutions but I dont get to show LoadingUI until all models with their textures is loaded.Firstly, I have these lines of code: var assetsManager = new BABYLON.AssetsManager(scene); assetsManager.useDefaultLoadingScreen = false; engine.displayLoadingUI(); After I call the main function that loads all models and later I call this function: scene.executeWhenReady( engine.hideLoadingUI.bind(engine)); but it doesnt work. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 20, 2016 Share Posted December 20, 2016 Do you mind sharing a playground test? It's gonna be easier to help you with it Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 21, 2016 Share Posted December 21, 2016 Might be difficult to repro. I saw scene... it is a "town". Many textures, many buildings... and quite beautiful. Textures were being added to scene... for about 45 seconds after first render. When loading .obj files that ref .mtl files, .mtl file cannot use assetManager textureTask, correct? Perhaps, when .obj mesh goes ready, scene.executeWhenReady runs. But .mtl might still be processing files, yes? .mtl files load differently than other textures, it seems. They are not really textures, correct? They are "texturing instructions"... possibly referencing many actual texture files from within one .mtl file, yes? For example: https://dl.dropboxusercontent.com/u/17799537/objFileLoader/Bane/Bane_3.mtl Would scene.executeWhenReady... wait for all those .tga files to finish loading? Or would EWR trigger when .mtl file finished ITS OWN load? *shrug* http://www.babylonjs-playground.com/#RBMUC#7 Here, we see model first, then textures appear later. Correct behavior? Not sure about any of this. I should probably stay non-involved. Wingnut not qualified to comment. heh Quote Link to comment Share on other sites More sharing options...
Nabroski Posted December 21, 2016 Share Posted December 21, 2016 @Wingnut Thank you for sharing my playground, im the only one for now who signed his playgrounds, and the one you shared isnt working well, so if you dont mind i fixed it. http://www.babylonjs-playground.com/#RBMUC#10 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 21, 2016 Share Posted December 21, 2016 Thx Nabs. I was trying to remove the palm tree texture and let the models load their default .mtl files. Trying to make a testing playground for Juan's issue. I needed slower-loading textures, slower and bigger than textures/palm.png. Testing if scene.executeWhenReady() is waiting for .mtl to finish it's work. Wondering if EWR is properly watching-for texture.isReady() flags from ALL reffed texture files inside .mtl files. In other words... feeling-around blindly. Thx for fix, though.... very kind. But, I wanted a non-palm.png version (and I screwed-up by not removing refs to pos). Your "palm tree monster" was a good starter PG for testing Juan's issue... because it uses assetsManager to load .obj files. I found another non-assetsManager .obj loader playground. (click canvas to see bane model) No assetsManager and no EWR, but there is a timeout to wait for textures to load. (lines 26-27). Perhaps this timeout was added... because EWR was executing too early. *shrug* I have strange troubleshooting methods, eh? *nod* But sometimes I get lucky and discover something. Old adage: "Even a blind squirrel finds an occasional acorn." heh. Wingnut being the blind squirrel, of course. Perhaps assetsManager is checking onSuccess for .obj load, but not waiting for textures from .mtl file... to finish being applied. *shrug* Perhaps when Juan loads many .obj files, .obj loading finishes quick, onSuccess triggers, LoadingUI stops, EWR executes... but .mtl files are not yet finished working. Not sure, though. Blind squirrel. 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.