Reference: Unit 21
I am using their materials and all the credits go to the creators of this wonderful scene.
Long story short, I looked at this scene and it was amazing. Problem is it doesn’t run on a mobile phone. So I set out to create a workflow to bring high quality scenes like this to mobile phones.
I have a guide talking about the extraction process from BABYLON and rebuilding it with Blender. Now here is how you compress it to get it run on a mobile phone.
-
Download ZenCompress Zen Compress Releases
-
Open the application and load a GLTF Separated file from Blender. Before you go on, visit this
website called GLTF Report to check how much memory your file will take in the VRAM
-
When you have Zen Compress open, Leave the settings default for now, Import GLTF Separate > Add Directory to Save Compressed > Export GLB
-
When it’s done you should have a GLB. Upload it to GLTF Report website and see the difference in VRAM
It went from 286MB in VRAM to 73MB in VRAM. That is super significant when you are working with mobile devices and such a massive feature to have in your arsenal.
Thank you to the Babylon.JS Team, The Khronos Group and all the wonderful individuals that tirelessly work everyday to make 3D on the web a dream come true for us developers and users who enjoy interacting with it everyday. Enjoy
**NOTE: A big factor in VRAM usage is the size of your textures. This one uses the default 4K textures for most of them. Another fix is downscaling the textures to 2K and then compressing them to save more on VRAM. This conversion table should help you. Keep in mind these are not accurate numbers just a rough estimate. (Per Texture)
1K - 5MB VRAM
2K - 22MB VRAM
4K - 90MB VRAM
**NOTE: To enable KTX Textures, in your code in the createscene function add the following line
//KTX Textures
BABYLON.KhronosTextureContainer2.DefaultNumWorkers = 0;