Help with memory, cpu and gpu usage

Hi all

I need help analysing my memory, CPU and GPU usage. Am loading up large models and playing animations using requestAnimiationFrame. Currently, we cannot use the standard gltf way so we loop over the meshes and enable the next mesh while disabling the next previous mesh. I have improved the code however we are getting serious bottlenecks when I reach over 1.5GB glb files most likely hardware related as If I use a better PC it can handle the larger files. I’d like to push it as much as I possibly can.

I looked at the memory usage and Chrome was using over 6GB and the GPU memory (4GB) was 100% utilized so it looks like the memory you need is about 4 times the size of the file. I’m wondering if Babylon pre-calculates the outward normal for each vertex in the model and then stores them in GPU memory.

Can anyone explain this, please?

We can easily have hundreds upon hundreds of materials and textures in the scene, also the meshes can push 1k. I’ve looked into optimizing the scene but doesn’t give much in relation to performance. Does anyone have any suggestions?

Many Thanks

seems like system procceses are overloading

It seems you have a quite heavy scene, with 108M+ vertices and 15M+ faces!

You can see better what’s going on by analyzing your frame with Spector. You will notably see which attributes (positions, normals, colors, …) are passed to the shader as well as the GPU memory size.

thank you i’ll try it out :slight_smile: on another note do you know why some hardwares result in webgl content loss. I have a new 3000 seriers gpu in another pc and when i load the big files with that it crashes with that error. while other hardware its fine

I have never experienced webgl content loss on my end, so I don’t know when that happens… I would say it’s when resources are becoming scarce and the system needs to free some for another app, but really don’t quote me on that!

Am not sure myself but it’s pretty powerful, don’t worry as it’s not a priority. Currently playing around with Spector, interesting to see what is going on within the engine. Will report back, do you think removing alot of those computations that arent not be needed to speed things up abit?

Which computations?

is the default for babylon flat shaded meshes or average per vertex shading?

We are doing per pixel lighting computation in the standard / PBR materials. You can avoid those computations if you disable lighting (mat.disableLighting=true for std material and mat.unlit=true for PBR).