I have simple mesh using standard material with texture.
I want to tint (mix/multiply some solid color with the texture) each instance basing on its position (or some other external parameter).
How can I achieve this effect? Is it even possible with standard material?
I’ve tried using vertexColor and standard material an I get some flickering. I don’t even know if it should work.
EDIT: OK, solved with instancedBuffers from the example. Used the second type of interface. I can’t tell how flickering dissapeared. I simply changed the way the buffers are registered as now I’m not using Mesh:setVerticesBuffer
.
To all newcomers like me. You have to set vertexBuffer values for both source mesh and instances.
mesh.registerInstancedBuffer("color", 4);
box.instancedBuffers.color = new BABYLON.Color4(Math.random(), Math.random(), Math.random(), 1);
let instance = box.createInstance("box1");
instance.instancedBuffers.color = new BABYLON.Color4(Math.random(), Math.random(), Math.random(), 1);