BMWPilote Posted July 11, 2018 Share Posted July 11, 2018 I have my own format and I need to load very big scenes which contain a lot of meshes. During loading, I need to keep the scene interactive. So my first idea is to force repaint for every N meshes. But it seems that manually calling scene.render() does not help. I would like to understand why? Quote Link to comment Share on other sites More sharing options...
BMWPilote Posted July 11, 2018 Author Share Posted July 11, 2018 BTW, I know that scene.render() does not necessarily trigger a refresh of the frame buffer. But how can it be done in WebGL as there is no SwapBuffer stuff? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 11, 2018 Share Posted July 11, 2018 Did you try setting scene.autoClear = true? http://doc.babylonjs.com/api/classes/babylon.scene#autoclear edit: since you are adding meshes maybe scene.incrementRenderId() may work? Quote Link to comment Share on other sites More sharing options...
BMWPilote Posted July 11, 2018 Author Share Posted July 11, 2018 2 hours ago, brianzinn said: Did you try setting scene.autoClear = true? http://doc.babylonjs.com/api/classes/babylon.scene#autoclear edit: since you are adding meshes maybe scene.incrementRenderId() may work? Could you explain more about scene.incrementRenderId(). Thanks in advance. Quote Link to comment Share on other sites More sharing options...
davrous Posted July 11, 2018 Share Posted July 11, 2018 Don't forget JavaScript is mono-threaded. So if your custom format loader is taking all the CPU, we won't be able to render anything until you've finished doing your job. To give more time to the UI thread, you can try to make some pauses between each big meshes load using setTimeout for instance. You can also try to do as much work as possible on a web worker. But as soon as the worker will need to join the UI Thread to send data, it will freeze the rendering anyway. BMWPilote, The Leftover and GameMonetize 3 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 11, 2018 Share Posted July 11, 2018 7 hours ago, BMWPilote said: Could you explain more about scene.incrementRenderId() I just remembered somebody saying that would force a render, but looking through the BJS source I don't see how... I would imagine davrous has your solution. Have you seen the asset manager - it has callbacks you can use also: https://doc.babylonjs.com/how_to/how_to_use_assetsmanager Quote Link to comment Share on other sites More sharing options...
BMWPilote Posted July 12, 2018 Author Share Posted July 12, 2018 16 hours ago, davrous said: Don't forget JavaScript is mono-threaded. So if your custom format loader is taking all the CPU, we won't be able to render anything until you've finished doing your job. To give more time to the UI thread, you can try to make some pauses between each big meshes load using setTimeout for instance. You can also try to do as much work as possible on a web worker. But as soon as the worker will need to join the UI Thread to send data, it will freeze the rendering anyway. So even if I interrupt loading by manually calling scene.render(), it does not refresh the frame buffer? This is the point which I don't understand. Quote Link to comment Share on other sites More sharing options...
JohnK Posted July 12, 2018 Share Posted July 12, 2018 If you have not read this topic it may offer some help Quote Link to comment Share on other sites More sharing options...
BMWPilote Posted July 13, 2018 Author Share Posted July 13, 2018 17 hours ago, JohnK said: If you have not read this topic it may offer some help Thank you. It's interesting. But I have another question, which is about the memory limit. While my scene is already split into chunks. But as it is a very big scene, so it means that at some moment, I need to remove meshes by following some criteria. BTW, what is the memory limit, for example in Chrome 64bit? 2GB? Is there a way to precisely query the available memory? 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.