Modify method for nerfing additive on terrain so it doesn't trip up deferred lighting and make light artifacts.
meow-7.2.2
Graham Linden 2019-06-27 16:07:54 -07:00
parent 4b8ec2f11f
commit 7c651f8423
3 changed files with 5 additions and 3 deletions

View File

@ -176,8 +176,9 @@ vec3 post_env = color.rgb;
if (norm.w < 1)
{
#if !defined(SUNLIGHT_KILL)
additive *= spec.a;
float additive_angular_atten = max(0.0, dot(light_dir, normalize(pos.xyz)));
color = atmosFragLighting(color, additive * additive_angular_atten * (1.0 - spec.a), atten);
color = atmosFragLighting(color, additive * additive_angular_atten, atten);
color = scaleSoftClipFrag(color);
#endif
}

View File

@ -69,7 +69,7 @@ void main()
#endif
frag_data[0] = outColor;
frag_data[1] = vec4(0.0,0.0,0.0,1.0);
frag_data[1] = vec4(0.0,0.0,0.0,-1.0);
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, 0.0);
}

View File

@ -185,8 +185,9 @@ vec3 post_env = color.rgb;
{
#if !defined(SUNLIGHT_KILL)
vec3 p = normalize(pos.xyz);
additive *= spec.a;
float additive_angular_atten = max(0.0, dot(light_dir.xyz, p.xyz));
color = atmosFragLighting(color, additive * additive_angular_atten * (1.0 - spec.a), atten);
color = atmosFragLighting(color, additive * additive_angular_atten, atten);
color = scaleSoftClipFrag(color);
#endif
}