Cast shadow on instance mesh

I know instance mesh cannot set its own shader. So something like this cannot work of course:
direct set custom shadow shader to instance mesh

But I found when I use standard material, shadow appears correctly on instance mesh.
It’s amazing. :flushed:
Can anyone give me some hints on how to achieve it?

As long as shadows are on on the material, they would work on instances.

The only constraint is that they all use the same mat.

Not sure to understand the question ???

Sorry for my bad expression. :joy_cat:
I create a scene, and there are one plane mesh with a couple of instances.
When I use default shader:

But when I use my custom shader:
The instance plane didn’t draw correctly.
I guess I miss something in my shader for drawing instance mesh.
Here is my (39.7 KB)

here is the PG

1 Like

If you remove the define from the shader option like this then it works as expected? ShaderMaterial will take care of the instances define for us so we don’t need to do it ourselves.

Also you can use the instancesDeclaration shader include to handle the world0…world3 attributes like this.


Thanks a ton @Blake !!!

1 Like