ondemand_video   animation
Reviewed: 2021-05-09

Baking textures results in one set of files for an entire model/mesh

Multiple meshes can also be baked into one mesh

This is used to reduce complexity, and can be used to reduce file sizes (and quality). The resulting output can be rolled into a .glb or used in native .babylon mesh files - and texture files can used as is in the .glb or with the mesh in any resulting format for any system.

Unity and packages needed

Ian Deane's Mesh Baker (and texture baker) - Unity Store ~ $40
FBX Export (free from Unity) - Unity Store - free

The texture baker has lots and lots of options - which we will mostly ignore and use it's default setup - which will generally work well for most cases converting models for use on the web.
FBX is the most regular format for meshes and models - Unity, Blender and Autodesk all inter operate well using FBX formats - and Blender is the best place to go from FBX to BabylonJS.

The recipe!

Select, download and import a package of models from Unity

Please download and import the 3 packages (FBX export, Ian Deane's Texture Baker and the package of assets you want to work with).
Select My Assets in Package Manager
Using the Search field to filter can help
Find the FBX Export in the 'Unity Registry' - not 'My Assets'
Filter Assets
Next add a meshbaker object to your project
Add Mesh Baker
Next add an object from "Prefabs" (versus models - these tend to be only the mesh here)
Also zero the coords to 0,0,0 (optional)
Keep this as the only object in the project (for later when we export)
Add prefab model

After baking and exporting a model

It's best to delete the generated material (and all associated files) from the directory, and also delete the generated object in the unity project, the texture baker object and the original fabrication generated object. This will create much more consistent results.

If [Bake Materials Into Combined Material] doesn't produce results, try clicking the [Blend Non-Texture Properies] checkbox.

Try not to include small details

Things like door knobs, TV screens (detail) - can greatly increase the size of a mesh and texture set. At times, try to remove a key part that can be added back - so the main item is one color/material - otherwise the baked texture set gets megabytes big instead of kilobytes.

At times remove sub meshes like knobs, screen displays, buttons, lights and other items that greatly increase the detail of the textures. This will make the models easier to manipulate and much smaller. Many times though, it makes sense to mix all the items into one batch - when there are more then a few sub items like 20 buttons, or 20 bottles, etc. Use these when needed and bake the textures for ease of use - but also keep the count in a scene small and make sure they are high impact items to make the download size worth it.