I’m trying to bind ShaderMaterial uniforms to specific values per mesh.
Initially it seemed like calling set uniform method at
onBindObservable would be the way, but because
onBindObservable after it has applied the specified uniform values it only makes the next rendered meshes use the desired value.
Then I was thinking that maybe I could set the values on the “effect” directly, but that wouldn’t work when the material can have multiple effects for different attribute combinations.
Here is a Playground test case. It generates random colors for each mesh and tries to apply them on material bind:
Any suggestions how to make this work without having to inject custom code to Babylon.js function prototypes?