createInstance with ShaderMaterial does not render

When a mesh with a ShaderMaterial is instanced using createInstance the instance does not render.
Removing the ShaderMaterial will cause the instance to render.
clone works as expected.

This looks like a bug to me, unless there is some setting I’m missing.

See playground (https://playground.babylonjs.com/#3MW2RI)

Hi @CarlBateman

I think this is expected. You are using your own custom shader which doesn’t have instancing support. Please check the following PG. I added instancing support from BABYLON instancing shader. Most of my changes are in your vertex shader. In js code, I only added an additional uniforms declaration “viewProjection” to your shader material.

https://playground.babylonjs.com/#3MW2RI#1

1 Like

Thanks

@CarlBateman Mistakenly deleted my answer by using touch pad. :rofl:

Add the PG again: https://playground.babylonjs.com/#3MW2RI#1

[Admin have undeleted your post]

1 Like