I'm using BabylonJS V3 with Blender 2.79 to create product visualizations. Many times, it is necessary for me to define more complex shaders in the JS code. I'm using lines like
scene.meshes[1].material.emissiveColor = new BABYLON.Color3(1, 0, 0);
to define the shaders after export. Usually every mesh can get it's own shader this way. Unfortunately, I can't get it to work somehow. Even in small test scenes (one red icosphere, one green cube, a hemi lamp and a camera), both objects get the same material. When trying to change the appearance like shown above, both meshes change color.
When I navigate the camera, so that one object isn't visible, the right material gets loaded (green, in my sample scene). Here is a small video of the strange behavior: https://imgur.com/a/zYlLT
Both blender meshes have individual datablocks and individual materials. No duplication, instancing ...
Do the mesh indices change, when a mesh gets unloaded? Where could I have made the mistake? In blender or in my .js?
I am greatful for every hint!