Commit a2eefed1 authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Fix alpha lighting producing undefined results that are different depending on driver

parent c9b7f1a1
......@@ -216,12 +216,9 @@ void main()
calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false);
float da = dot(norm.xyz, light_dir.xyz);
da = clamp(da, -1.0, 1.0);
da = pow(da, 1.0/1.3);
float final_da = da;
final_da = clamp(final_da, 0.0f, 1.0f);
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
da = pow(da, 1.0 / 1.3);
vec4 color = vec4(0.0);
......@@ -232,7 +229,7 @@ void main()
ambient *= ambient;
ambient = (1.0 - ambient);
vec3 sun_contrib = min(final_da, shadow) * sunlit;
vec3 sun_contrib = min(da, shadow) * sunlit;
#if !defined(AMBIENT_KILL)
color.rgb = amblit;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment