Difference between instanced/non-instanced with alpha materials and shadows

I think I found an inconsistency in (latest) babylon.

To reproduce you need:

  • An instanced mesh
  • Alpha blending on material
  • Add as shadow caster

The mesh then is not rendered at all. Without instances the mesh show (but has no shadow).

Here it is reproduced in the playground:
https://playground.babylonjs.com/#JUP4YH#4

Is this supposed to be supported? I can understand the lack of shadow, I am thinking of the primary rendering not happening.

Cheers!

If I uncomment the line //ground.receiveShadows = true everything seems to work as expected:

https://playground.babylonjs.com/#JUP4YH#5

?

I do see shadows for all 10 spheres.

Remove the ! from line 5 and the shadows and half the spheres disappear.

https://playground.babylonjs.com/#JUP4YH#6

Ah my bad, forgot this one.

When setting shadowGenerator.transparencyShadow to true it does display the spheres + shadows in alpha mode, so it seems the alpha parameter is not used correctly for instances when transparencyShadow is false

Perhaps I should have waited a day to post but I really wanted to get the report away. But @jeff2365 found the issue anyway, great! I made an updated version here

https://playground.babylonjs.com/#JUP4YH#7

It also tests transparencyShadow on the shadowGenerator and with it enabled it works. So the error condition is:

  • transparencyShadow = false
  • shadow = true
  • alpha on material
  • mesh should be instanced

Problem then is that the mesh is not rendered

This also helped me with a workaround (by setting transparencyShadow to true) temporarily. Thanks!

Will be fixed by:

2 Likes

Ah thanks!

This is now live.

2 Likes