We have a small issue which is regarding memory shoot-up. Scene is loading perfectly alright no issues with the scene but when we load the scene initially it is taking hell lot of memory to load. The scene file is hardly less than 30 MB, but while loading memory is shooting up-to 1 GB which is a problem to showcase in mobile devices.If i load all the other functionalities like adding light maps, videos and image sliders it is shooting up-to 3 GB. Can you please guide us so that we can load the scene with as less memory as possible…
As there is plenty of memory on a desktop, the memory consumption will grow more than on a mobile before the GC kicks in. On a mobile, the GC will kick in more often but that should still work (except if no memory can be reclaimed when the js system needs more memory).
Besides the issues that other people have already mentioned, this asset also has some inefficient usage of textures. There are a bunch of (I count 16) 1024x1024 solid color images in the asset that shouldn’t be using textures at all. These will get expanded into a 1024x1024 on the CPU so that it can get uploaded to the GPU when it doesn’t need to at all since it’s solid.
@sai_chaitanya, @Krishna_Kishore I’m not too sure if we’ll get much benefit from asset optimization… Some preliminary analysis looks like the scene is using an appropriate amount of memory after loading completes:
we tried optimizing the assets no luck as you send, this is happening to some of our scenes we created, glb files hardly 30 MB but memory is consuming , what we observed when ever we apply the light maps the memory is shoot up
I’m seeing 84 textures from your file,
some are not power of 2,
some are very big, 4096, 2500, 1024
many wall textures are 1024x1024 solid single color textures
I suggest you go through your textures and ask for each, Is it power of two? Textures which are not power of 2 will be roofed to nearest power of 2 on the GPU, 1194x862 becomes 2048x2048. Can it be reduced in pixel size? Many times, there’s no need for 1024px textures. Often 512 is enough if it’s not a large model, even 256 for smaller models Can it be replaced by a solid color? I see solid 1024px wall textures, can these be replaced by colors? or are they placeholders?
I also note multiple textures for wall posters, the actual textures are half-texture poster images, and other half is solid color, can some of these be combined? 1 texture for 2 posters?
Could it come from some meshes with many vertices? They aren’t look huge to me, but maybe this occur when the engine parse the vertex buffer for each mesh or something like that?
Maybe it could come from some code in your app? In sandbox the .glb seems to load normally.
when we load this model in babylon scene which is in playground, it is taking almost 1GB of RAM, i just want to know why it is taking almost 800 MB of memory considering 200 MB is taking by default by browser , is there some thing we are doing wrong in modeling, is it expected behavior