Sign in to follow this  
BMWPilote

How can I force repaint?

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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? 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.