Jump to content

How can I force repaint?


BMWPilote
 Share

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?

Link to comment
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. 

Link to comment
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

Link to comment
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.

Link to comment
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? 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...