What is the maximum count for materials in materials array for one mesh?

I want to build InstancedMesh with multiple states for each instance and for each state I want to use separate material (and separate group in BufferGeometry).

My question is, is there a hardware or code limit for the length of materials array for one mesh?


Using more than one material with an InstancedMesh will (if it’s supported at all, it may not be…) lose the benefits of instancing. One mesh/material pair is one draw call, every material added to a buffergeometry group will add a new draw call.

It would be better to use the instancedmesh setColorAt(...) API to customize colors of instances, if possible for your use case, or to use separate InstancedMesh objects for each material if not.