Hello and welcome
I think that the Blender exporter gets rid of unassigned materials anyway…
What you could do is exporting one (very light, a plane…) object and assign a material per face :
and then on BJS side you would hide this mesh, but retreive all the materials, and bind your click to switch materials on another mesh (sphere) : Playground
++
Tricotou