Issue with multiple lights casting shadows

Hello there
i’m having trouble setting up multiple light with shadows on my project.
followed the instructions on the docs, and it works fine in the playground
but in my project it only cast shadows for the first light i set up
i added one shadowgenerator for each light like in the demos, but for some reason this doesn’t work


here i set two directional lights (one red and one white) and only the first added is casting shadows
is there anything that prevent multiple shadows from different sources to be cast?
this project is pretty big, and i’m not sure if there is some configuration that i missed that is preventing this to work properly

Welcome to the forums!

Can you create a playground so that we can more easily help?

hey @bghgary
thanks for the reply

i’m not able to reproduce into the playground, thats why i’m thinking there is something wrong with my project.
what i tried to archive is this https://playground.babylonjs.com/#IFYDRS#315
its just the demo for shadows in the documentation, but with 2 directional lights
i set one to red to make it easier to see
in the playground it works fine, both shadows appear
but in my project, only one shadow appears
everything its pretty much the same as the demo
just the ground material is a shadowonly material, but i tested with a normal standard material and it have the same result

I believe there is a small difference which leads to error.

It will be hard to help without a repro. Can you share your project somehow?

1 Like

forgot to post an update on this
i couldn’t share my project because is a private one
but i managed to figure out what were wrong
there were a couple of things:
first was the shadowOnlyMaterial, that only acpeted the first light that were set
the second one was the enviromentTexture that were interfiring with the lights/shadows

3 Likes