Directional light lits objects in shadow if shadow strength is not 1

Hi everyone :slight_smile:
I’ve been struggling with some issue I had on a day/night system (involves sun light and moon light as directional lights, and lerps of shadow strength to make better transitions)

The point is that I noticed that there is some kind of light passing through objects in shadows if the shadow strength of the main directional light on the scene is not 1.

My intuition says that shadow strength should be about the intensity of the shadow, but this one should not let any kind of “global ghosty light” pass through.
And yeah, I thought on using environment light instead shadow strength, but it makes things even more complex and hard to control (and transition I expect to achieve won’t be the same)

Can some confirm me if this is a normal behaviour?
Is there a way to avoid this effect when shadow strength is not 1 and objects are in shadow places?
Actually I’m using materials on my objects made in shadergraph. If there is some way to disable them from there, some keyword or setting, it will be nice.

Thanks for your time :slight_smile:

The place is dark because it is enclosed (in shadow), so if you reduce the amount of shadow being cast, it will lighten up.
To set this up differently, you could work with the lighting settings to change the indirect lighting, or make custom shaders making the materials indoors darker?

Post processing using volumes could also help (make scene darker when entering an enclosed space)

Thank for your answer!
But my issue is not related with the amount of darkness. The issue is that, if shadow strength is not 1 (max) and then I rotate this directional light, there’s still a lighting on objects based on light direction. And I want to get rid of those, first, because they are not physically or logically accurate, and second, because it breaks immersion on day/night systems with shadow strength involved on them.

Indirect light does not affect to this effect, as far as I check, disabling it does not fix it.
The only “kind of” solution I found was setting up shadow strength always to 1, and use ambient light to reduce its “darkness”, but to achieve something slightly close to what I need in terms of shadow behaviour, I must overburn the whole scene with ambient light intensity on some moments of the day/night cycle. And that’s a big nope.

So yeah, basically my question is how to get rid of that slightly light effect.

Hi, this is a normal behaviour in real-time rendering.

The shadow rendering technique is quite direct, which renders the scene at the perspective of a light. Areas that the light can’t “see” are considered as shadow. Then the shadow factor will be used to darken the lighting.

So, the real-time shadow strength only controls the shadow factor of that light.

If you’re implementing a day/night cycle, you should gradually change the main light intensity to 0 when sun is below the horizon.

If you’d like to bright up the interior, you can either control the exposure (in color adjustment) with a local URP volume or adding artificial lights to it.

Hi, and thanks for your reply. There is still something that escapes from my understanding of the system. By what I can try to understand by your words is:

-First, all objects on scene receive light on the side where light cames from, ignoring collisions and everything.
-Second, shadow “shapes” are calculated and drawn, substracting to the first pass, the amount of light set on shadow strength.

My question is, is there absolutely no way to avoid first thing happening on objects in shadow by second one?

If there’s no way I will try to do something involving ambient color to keep shadow strength 1 and still have the lerp I’m looking for (since on my system is not as simple as putting shadow strength=1 always). Even tho, I’ll like to know if there is some way to avoid it, some keyword for shadergraph or custom extra pass.

But yeah, for me, current behaviour makes no sense. It shouldn’t be still calculating direction of light on objects in shadow. Firstly because that is not the behaviour of a directional light in life, and second, it makes you think that “objects casting shadows may be some kind of crystal” that let light go through, but is neither it because shadow shapes are not calculated on the light from first step.

This means, if I have a house and a tree, and the tree is casting shadow over the house, if shadow strength is less than 1 we can see objects inside the house receive light based on where the sun is, even if the walls are blocking the sun, and even that slight light has not the shape of the tree’s shadow neither. Is just a base light that we have to try to deal with.

Yes it makes no sense compared to reality but that’s how it (that shadow parameter) works.

Usually you don’t need to change the shadow strength, and it’s even a hidden parameter in HDRP.

1 Like