RAM, texture size and tab throttling

Hi All,

We have created a project in Babylon, but sometimes when running it can reach 700MB + of RAM. We think this might be causing some of the crashes we are experiencing on lower spec laptops. With this in mind I have a few questions, if anyone can help.

  1. Is there and easy way to be able to identify what is using lots of memory. Textures, geometry, pathfinding etc. At the moment we are a bit blind.

  2. Do textures get uncompressed when running in realtime 3d? I know from working with Unity, you can use a 200Kb JPEG for a texture, but when it is actually put into the scene it becomes more like 10x this size as the 3D engine doesn’t use image compression. Is this the same for babylon, and so could this be the reason our project is taking up so much RAM?

  3. We have noticed that we get around 40fps on some older laptops, which is fine, but if we add more animated NPC’s the frame rate goes down, which makes sense. The odd thing is that if we open another tab on another window with the same project running (so x2 projects running) we still get 40fps on both. This seems really odd, as we are doubling the load by running it twice but the fps is the same. Does chrome only allow a certain amount of GPU/CPU power per browser tab/throttle each tab? Seems odd.

Many thanks in advance for any input

Hi @B00_clay

  1. You can use the memory profiler in chrome dev tool.
  2. I think it would be the same no matter what framework you use. When the image is loaded for rendering, it needs to be decompressed. The image data size in the memory should be sizeOfRGBA * imageWidth * imageHeight.
  3. This is correct. Only selected active tab is processed by the browser.
1 Like

Hi slin,

Really great info here. Thank you very much. Oddly on the third point we had both tabs processing at the same time on two different monitors, so it does seem strange that running it twice didn’t impact the frame rate, but adding more geometry to one of them did. Just seemed like chrome was limiting each tabs gpu,cpu power.

MNy thanks

Regarding 2/, you can lower the GPU memory footprint of textures by using compressed textures like .ktx2 in the first place.

2 Likes

Hi @B00_clay

I think my answer is wrong regard your pt 3. I was thinking the JS tab throttling you said. And I was thinking tab on the background (tabs on the same chrome window on a single monitor). I just tested myself. The behaviour is like following:

  1. One tab is shown on monitor A. The other tab is on the background on monitor A. FPS 60.
  2. One tab visible on monitor A. The other tab is on the background on monitor B (e.g. awesome babylon forum tab is active on monitor B). FPS 60.
  3. Both tabs are the front running tabs on two monitors. FPS drop to 30 each.

So it seems GPU power is splited to multiple canvas context if multiple tabs have webgl content on the foreground.

1 Like

Ah ok fair enough. Maybe we need to do more testing. Also interesting about the .ktx2 textures, I have never head of them. Will Google:-) cheers

We have some docs on .ktx2:

1 Like

Ace, depending on the deduction in size, this could solve the problem. Thank you