Can billboards face light sources for shadows?

Not sure if this is doable or if the effort would be very high but thought I’d throw this out there.

I’m working on a simple 2.5D game and the most visually displeasing thing right now is that when you move around the shadows for tall trees (billboard Y-axis) grow and shrink depending on the billboard’s rotation to the light. Here is a quick video: https://youtu.be/NiCJl96RO4E

What I visually want is for the tree shadows to always be the full size shadow (as if the tree faces the light source for the shadow.)

@JacobF you could maybe create a second, custom light-aligned billboard using TransformNode.lookAt() . I’d imagine it should also be possible to make this second, light-aligned version invisible to the camera yet still cast shadows, but I’m unsure exactly how to do that just yet.

I found this PG - simple to hide the second custom billboard yet still make it cast shadows

https://www.babylonjs-playground.com/#PY2MKZ#5

1 Like

Sweet, that actually worked out pretty well. The only thing is I needed to remove shadowGenerator.enableSoftTransparentShadow = true so hopefully I don’t need that in the future :sweat_smile: Thanks!

1 Like