Jump to content

Babylonjs consumes too much memory


BMWPilote
 Share

Recommended Posts

Every AbstractMesh holds a BoundingInfo and the BoundingInfo consumes too much memory. The internal bounding box holds a lot of vectors. So if we have a quite big scene, let's say 100 000 meshes, only the bounding boxes consume hundreds of mega bytes...I have'v count other stuff yet but comparing to pure vertex buffer + index buffer, the overhead is really heavy.

Link to comment
Share on other sites

Well this is expected no?

We try to keep only necessary data and have every thing else lazy loaded.

The bounding infos for instance are mandatory to do the frustum clipping.

You can consider setting the bounding info to null and then mark all meshes as mesh.alwaysSelectAsActiveMesh = true

 

Link to comment
Share on other sites

Also for the vectors hold by the bounding info: it is always a trade-off between performance and memory. So the bounding info keeps some vectors to avoid computing everything on every call which will kill performance 

Link to comment
Share on other sites

2 hours ago, Deltakosh said:

A bounding info should contains 20 vector3 (approximately)

So 20x3x4 bytes 120 bytes

So for 100000 meshes it will be 12mb. Nothing compared to the memory sized used by mesh or texture data.

If you want to save large chunk of memory I encourage you reading this: http://doc.babylonjs.com/how_to/reduce_memory_footprint

OK Thank you big boss.

But in my case, I need to handle picking, so that I cannot clear the buffers on CPU side. :( And enableOfflineSupport does not work for custom format right?

Is there anyway to do paging in the world of Web?

 

Hum for rendering I hacked the class Scene an I am doing progressive rendering so it is not a problem. My only problem is memory now...:(

Loading big models crashes the browser. I would like to collect ideas here and there so that I can know what to do in the next sprints...

 

I know another possibility is doing on demand loading and unloading but it would be my last choice. I have one scene which contains more than 70 000 000 triangles...

Link to comment
Share on other sites

70 millions triangles + 100 000 meshes + picking enable on all meshes = very few solutions to limit lag. Some ideas off the cuff:

  • reduce your polycount
  • freeze all meshes & materials, and use UI to interact with objects (allowing to freeze/unfreeze on the fly)
  • divide your scene into multiple scenes
  • having last most powerful GPU & CPU & a browser without any plugins
Link to comment
Share on other sites

Yes, ask all users to have the latest graphics card and a latest-generation I7 processor. :D

100 000 mailles is really huge. I do not even know how to add so many objects to a scene, it must be a sacred work to achieve. Very very long. I do not even imagine how many images there are to load.

To add 1000 meshes already on a scene is already enormous provided to have instances to create otherwise the FPS are really low and the users will not really be able to benefit from your game and will leave after 2 minutes of use.

Link to comment
Share on other sites

9 hours ago, Deltakosh said:

chrome is a 64bit process so the limit is really high. The problem will be GPU memory

My problem is that I have a computer which has 16GB RAM and 4GB GPU RAM. 

image.png.7bee6b9a0fe35aae626b9d779c0c6b82.png

But when the above one consumes more than around 2G, it crashes. But if we look at the Task Manager on Windows, chrome consumes already 7GB memory. So I am really confused...

 

Link to comment
Share on other sites

3 hours ago, Dad72 said:

You use something in 32 bit for not that it exceeds 2 GB. The 32 bit does not manage more than 2 GB. May be a track to explore.

Could you please give me more ideas? I know that my chrome is indeed 64 bit. What else could be 32 bit?

Link to comment
Share on other sites

I can not really know it for you, I do not know what you have on your computer and what you use.

I suppose because usually if something does not exceed 2 GB of memory is because of the 32 bit. But it may be something else.

Link to comment
Share on other sites

Also in optimization phase and ran across this  simultaneously...

https://blog.raananweber.com/2015/09/03/scene-optimization-in-babylon-js/

friend @RaananW says crystal clear:

Quote

Too many or high quality meshes can cause your scene to render very slowly, especially on computers without a strong GPU. Let's see what can be done to solve those issues.

So hooray, bird on topic (marks on calendar) : )

Hit jRad with the similar question about a year back, on run-time vertex editing utility.... 

@BMWPilote Maybe that helps you.

Are Instances applicable?

https://doc.babylonjs.com/how_to/how_to_use_instances

Or LOD?: 

https://doc.babylonjs.com/how_to/how_to_use_lod

https://doc.babylonjs.com/how_to/in-browser_mesh_simplification

cheers!

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...