- Home /
Shader Graph: Objects have no shadows opposite the Main Light
I'm working with Shader Graph for the first time in URP and have run into an issue. I just finished adapting a toon shading tutorial into the Graph and everything works except the shadows: while objects cast shadows just fine, they seem to have lost all shading / light data on the side opposite to the main directional light, like self shadows are messed up. Normal bias is not strong enough to cover these faces, and they received lighting direction just fine until Shadow Attenuation was added to the lighting computation. Any advice?
With shadow attenuation removed:
I suppose this would be helpful to add: this is the offending bit of graph:
Shadows seem to render correctly until they get passed through the gradient sample. The first custom function node is merely a standard "get main light data" script that seems to have no errors. The second is:
uv = float(1 - (NdotL * .5 +.5));
which intends to map the raw lighting to a time sample for the gradient.
Answer by radarhead7 · Oct 26, 2020 at 11:08 PM
I actually managed to find a weird solution on my own. I tried using a darken blend node instead of multiply, which seems to allow support of both cast shadows and a gradient override for the object shading! This did result in less intense shadows, so I had to turn shadow strength back to max and use a blend value of 1.2.
Your answer
Follow this Question
Related Questions
Is it possible to get shadows of each light in seperate channel ? 0 Answers
Unity Shader Render Queue Causing Various Problems. 0 Answers
Shadow caster and display order conflict 0 Answers
Inconvenient splotchy lightmaps/ UV Overlap in URP 0 Answers
Shader shows different result in viewport than gameview 0 Answers