Use MultiMaterials without subMeshes

Hi guys,

i want to use multi materials without defining subMeshes. Is that possible?
For example I want to render my scene with the first entry of my multimaterial and on a certain event I want to change the used material to material 2 or 3 or whatever.
As far as I understand, normaly this change can be realised by using the materialIndex on a submesh.
But my mesh doesnt have this materialIndex.

Any ideas on this?
Thanks!

Not entirely clear on your usage. Multi materials is for applying different materials to different parts of a mesh. Your description implies changing the material of a mesh following an event. The latter is easily done by changing the value of the material property of a mesh.

2 Likes

Yeah, actually I achieved my goal through using the mesh.renderOverlay functionality.
I was not aware of this possibility until 5 mins ago…

1 Like

I still get zfighting with mesh.renderOverlay, I instead created a new shader which blends the textures I want at the specific spot. If you run into zfighting, consider alternatives.