Hey guys, I would like to first push forward my PG example here:
The question is simple! Here I have a mergedMesh of a group of spheres, which has a multiMaterial consist of 3 standardMaterials. Then an instancedMesh is created from this mergedMesh, resulting in two groups of spheres in the scene.
The problem is that I wish to change the color / material of any one sphere in the instancedMesh without influencing the spheres in the mergedMesh, yet I found it hard to achieve. Here is some of my attemps:
-
I’ve tried to alter the instanceBuffer.color property of the instancedMesh, but it changed the color of all spheres rather than the one I wanted.
-
I’ve tried to set subMesh[i].materialIndex = 1 for the instancedMesh, which did not work at all, and if I set subMesh[i].materialIndex = 1 for the mergedMesh, two spheres changed their color simutaneously.
-
I’ve tried to set instancedMesh.material = mutiMaterial, yet an error came out indicating that instancedMesh has only a getter on material property.
So what is the right way to do this? It bothers me for more than a weeeeeek.