Ambient lighting for directional light

Hi there.
I have mesh with 2 polygons and one directonal light.
The problem is when face of the mesh parallel to the light direction, it becomes completely black.


I’d like such faces to be just slightly darker(not 100% black).
Is there way to set ambient lighting for directional light?
I tried to play with Environment options in Windows->Rendering->Lighting but it doesn’t seem to affect anything in the game view.

In the lighting settings you should go to the environment settings and here you can change ambient light to color or gradient.
In newer unity versions you still need to build it in the bottom right of the window

Nope environment settings not changing anything. Rebaking also do nothing.

I noticed environment settings work ok for default Lit material. Looks like you have to account ambient light manualy in custom URP shader graph.
That’s weird as my material defenetely receives some light from the light source, just without ambient component.

Are you up to date with Unity?
If youre using the lit output in SG you should not have any issues. If so, file a bug report

I’m on Unity 6 beta. Will check on the most recent version a bit later. Thanks.

Is this a custom shader?

Yes, it’s custom shader graph based on Lit material, which basicaly just draws a grid on a white background.

It shouldn’t be much different than the normal lit shader but it might depend on some settings.

If upgrading out of beta doesn’t help, post the graph.

1 Like

Upgraded to Unity 6000.0.30f1 - same result:

Attaching shadergraph file
Paper_URP.rar (11.5 KB)

Looks like you created a sprite Lit shader graph, and then changed to Lit.

I think it’s because the sprite shader graph automatically disables some URP shader keywords, so you may find it strange that there’s no ambient light with the same shader graph settings.

Easiest solution: you can select + copy all the properties & nodes (Ctrl + Click), then paste them into a new Lit shader graph.

By the way, I suggest making a bug report because Unity should change back these keywords if we change the material type.

1 Like

The problem was in Ambient Occlusion parameter of the shader graph. I had it equal to 0. Setting it to 1 brings env. lighting back.
This one is confusing. I always thought ambient occlusion is just post-processing effect.

Thanks for the all involved.

1 Like

Good find. Can you file a bug report for this? SSAO should definitely be a post processing effect

I dont’t think there is a bug.
Probably Unity do some post-processing no matter of the scene settings where ambient light is added.

SSAO shouldnt affect taht tho

No this is correct, you use AO map’s to block ambient lighting, it is all a material feature, a shader feature, and a post process especially in URP.

If you set AO to 0 without a map you just mask all ambient light.

1 Like

Ahhhhhh I was thinking SSAO, not regular AO. Nevermind them, that’s right!

1 Like

Fun fact SSAO in unity also affects the material and can be controlled by it’s shader :wink:

1 Like