BABYLON.CustomMaterial manually binding

For performance reasons I manually bind CustomMaterial and this works fine until I have multiple instances.

I use the method:

BABYLON.CustomMaterial._preBind(BABYLON.Effect)

After _prebind i set my-shader uniforms variables on the Effect and this works as expected with one instance. If I have more then one instance it seems randomly what instance the program is running on.

Anyone has knowledge about this ? :slightly_smiling_face:

You should use onBindObservable instead. As not all uniforms go into a uniform buffer, bindings have to be done each time before rendering.

Thanks for the update and solution :slight_smile: