Loading Optimization

Hello there, I have a few questions if you don’t mind helping me :slight_smile:

I working on a watch project using babylonjs and I used Unity to compute their lightmaps.

My watches FBX imported in Unity are about 20Mo but once I export my scene using the babylon toolkit from Unity, the output file is about 100Mo…

This loads decently on PC, this takes about 10 seconds which is acceptable but I’m supposed to make it work on mobile devices too… And it obviously takes some time to load 100Mo, about a minute on my test mobile.

I have tried with my mesh converted to Incremental mode and it kinda helps but creates other issues that I would like to avoid.

This leaves me with a few questions :

  • It seems that the GLTF format is lighter than the Babylon one according to my tests (made on 3dsMax). Is that generally correct? If so, is there a way to export my unity scene into the GLTF format?

  • Could it be possible to use the draco compression to reduce my number of polys? I looked for a way to do it in Unity and even bought a 50$ feature in the asset store that had terrible results…
    (I also tried to optimize my meshes using the 3dsMax algorithms that work well in max but transferred to Unity it seems to self-add a huge number of useless ones).

  • Any other idea I don’t have thought of that might help me?

Thank you guys!

I forgot to mention :

The 3D Models of my watches are private so I can’t post them on the forum but I don’t mind to send you my unity scene in private message if you are willing to help.

Thanks!

Adding @bghgary and @PatrickRyan for the GLTF optim. Yup GLTF + Draco + Basis might lead to a drastic size improvment. I am pretty sure they ll be able to guide you on the process to follow.

1 Like

@jeremy219, I have a few questions for you about your process. Is there a reason you are importing the FBX to Unity to convert to FBX rather than exporting directly to FBX from your DCC package? Maya and Max are covered with exporters from the Babylon team, Blender 2.8 has an integrated glTF exporter, Blender 2.7 has an exporter available from the Khronos group, Houdini has native export, Modo has native export, and even Substance Painter can export a static model without animation data to glTF.

I am wondering if there is a pipeline reason for you to pass through Unity first. I am also curious if you are exporting to glTF or glb? I am assuming glb if your file size increases by that much. I also assume you are not embedding media into your FBX which would account for the file size increase as your textures would contribute their size to the glb total as the glb is a container for the glTF file (json of the file parameters), the mesh binary, and all textures enumerated in the glTF.

If you are not exporting to glb, and the glTF json is blowing up in size like that, this will be a different investigation. Draco compression will help with the size of the mesh binary, and there is an option to include it in the exporters we have made, but Basis is not fully integrated yet. My guess is that you are using large textures, and multiple materials. The best way to save space is to make sure you’ve optimized your textures manually even before running any compression. That means channel packing an ORM texture (Occlusion/Roughness/Metallic in R/G/B) to reduce the number of textures, making sure that you have optimized your UV layout to reduce the overall number of materials, making sure to only split materials when you need to change blending mode (all opaque meshes assigned to one material and all transparent meshes assigned to a second) which reduces your overall size, reducing texture size when possible, and using the most optimal file format for the content (jpg files for textures with a lot of color variation and png for textures with large areas of flat color, test each format for your images to find the smallest file size). When Basis is ready, you won’t have to do the file format dance as our initial tests show it does better compression, but the other optimizations still help Basis.

If you would like us to look at your model, please feel free to message one of us directly. I am out of town and away from a computer for the rest of the week, but am happy to help when I am back in front of a computer.

3 Likes

I always felt this was the true essence of unity.

1 Like

-> I have to pass through Unity to compute the lightmaps of my meshes. Once I got the render I need I export it in .babylon using the babylon toolkit made by MackeyK24.

I am working on a configurator that is kindof the same as this one :

I achieved every hope I had in terms of renders and performance, the only problem remaining is the loading.

Unity has a real superpower in terms of computing lightmaps this is why I need go through it.

-> You’re right here! My textures are in pretty high quality but i managed to keep their size pretty light. (None of them are higher than 3Mo).

1 Like

@bghgary @MackeyK24 Any suggestions on how I could approach this? :slight_smile:

Depending on what you need, glTF might not be able to do it. You mention lightmaps which are not supported in glTF core spec. An extension might help but it will require importers and exporters to support it.

I think perhaps it would be good to capture a profile using Chrome Dev Tools or something similar to see where the bottleneck is.