Lighting config: single directional light with hard shadows.
After upgrading from Unit 5.4.3 to 5.6.2, shadow rendering has changed as below.
I would like to turn OFF the gradient effect, is there a way to do this?
Unity 5.6.2
Unity 5.4.3
Lighting config: single directional light with hard shadows.
After upgrading from Unit 5.4.3 to 5.6.2, shadow rendering has changed as below.
I would like to turn OFF the gradient effect, is there a way to do this?
Shadow distance in quality settings.
Unfortunately that will reduce shadow quality (more geometry rendered into the same shadow map). Good workaround though, but a last resort.
Hoping for a solution. What exactly changed between Unity 5.4.3 and 5.6.2 in this regards. Is it configurable? Nothing in the project source has changed, just upgrading Unity changed the rendered image.
I think what he’s saying is the screenshot of 5.4.3 the shadow distance is very low, resulting in the gradient effect. In the top screenshot the shadow distance is higher.
Is there a way to remove the gradient altogether in 5.6.2? - at the end of the shadow distance, the shadow needs to get cut (no smooth blending due to the gradient).
I’m not sure that there is unless you make your own shadow system, usually a harsh cutting of shadows is not what people want simply because it doesn’t look correct.
I’m not aware of any setting in the editor that affects this behavior.
I got rid of shadow distance fading by implementing a custom lighting function in our surface shaders, that modified the incoming “atten(uation)” parameter. As far as I remember, it’s a while ago, the “atten” parameter is a value between 0…1 that represents either how much shadow or light this pixel receives. By modifying “atten” to either 0 or 1 (but no value inbetween), the shadow had full length and no fade. However, in our project we also had one directional light only. Not sure if it works if there are multiple lights.
The code looked like this:
half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten)
{
// make atten either 0 or 1 to avoid any shadow fading
atten = step(atten, 0.01);
//atten = step(atten, 0.99);
half NdotL = dot (s.Normal, lightDir);
half4 c;
c.rgb = s.Albedo * _LightColor0.rgb * (NdotL * atten);
c.a = s.Alpha;
return c;
}
There is probably a smarter way of doing this, but it was the easiest solution I could think of when I had to implement it and it never caused any noticable glitches in our project.
Thanks Peter.
Would you be able to share a complete working shader source. Currently I am only trying to get the mobile diffuse shader to support this feature.