- Home /
How to stop light from going through an object on to another object?
Hi,
I have spotlights with a mask, to only cast thin line of light into the scene (see in picture). Every object as well as the light is set to cast and receive shadows but still the light (coming from the right side) hits the wall and shines right through on to the wall behind it where the window is. The wall in front and the wall in the back are separate objects. Is there a way to keep the light blocked by the first wall in realtime? I don't even need a shadow on the back wall. I just want to keep the light from shining through.
thanks in advance :)
Please, turn off all the lights but the right one and upload image so we can see how the wall is not stopping it, because in that image we can't see the effect.
Here you go :) So the light is co$$anonymous$$g from the right side. And for my understanding there shouldn't be any light visible on the wall on the left.
$$anonymous$$aybe this perspective is a bit more understandable :)
and this is also the case when you push the front into the back wall?
Yes, it is... I realised that for some reason I didn't get any shadows in that scene no matter what I did. I created a new scene and it works in that one but it is definitely not perfect. For example when I push the light source closer to the front wall the light starts going through the wall again.
But creating a new scene did help at least. I hope that I can work out the rest which isn't quite working.
Answer by MSachs · Oct 02, 2018 at 08:46 AM
I got it to work. There was something wrong with my scene. I created a new one, enabled all relevant shadows and switched out the multiple spotlights for just one point light with a mask. Now everything works as intended.
Answer by Pakillottk · Oct 01, 2018 at 11:09 PM
Can be that there's a little gap between the two walls and light it's just passing through? Try to make them closer, maybe even intersecting a little bit.
I tried that already with no different outcome. I realised that I didn't have any shadows in this scene no matter what I did so I created a new one and now it seems to work better.
Your answer
Follow this Question
Related Questions
My lighting is weird 1 Answer
The light is not blending 0 Answers
Modify 2D Point Light Distance in runtime? 1 Answer
URP shadow problem 0 Answers
Prefab asset lights differently in different scenes 0 Answers