I am exporting my models as a glTF file (using glTF-Blender-IO) and importing it into Babylon.JS which is working successfully. I can see how I can go about changing the meshes which are visible by having multiple meshes in Blender and selectively showing/hiding them in Babylon so that only the desired mesh is visible at any one time. The issue I am having is thinking about how I can export alternate materials from Blender.
I am able to switch the materials used between meshes easily in Babylon.JS easily by simply changing the material for the mesh to one of the other materials in the scene. The problem is that I am only able to export the materials which are assigned to a mesh and can only export one material per mesh. Ideally I would like to be able to export a large number of materials from Blender so that they are available for use in Babylon.JS but at the minute the only way I can think to do this is to create a dummy mesh for each material which is not visible when rendered. I wonder if anyone knows of a better way of achieving this?