If initUniformsPerInstance is called to use per-instance uniforms, the material passed to the BatchedMesh constructor is modified, adding an onBeforeCompile callback to customize the shader. If the same material is used for multiple batches, that material will have the callback added one time for each batch, resulting in a shader compile error.
It is useful to use the same material across multiple batches if there are other differences between the batches. For example, one may have a normalized geometry attribute where the other does not. Or a batch may be big and have to be split into multiple batches.
If
initUniformsPerInstanceis called to use per-instance uniforms, the material passed to theBatchedMeshconstructor is modified, adding anonBeforeCompilecallback to customize the shader. If the same material is used for multiple batches, that material will have the callback added one time for each batch, resulting in a shader compile error.It is useful to use the same material across multiple batches if there are other differences between the batches. For example, one may have a normalized geometry attribute where the other does not. Or a batch may be big and have to be split into multiple batches.