Mitigation for light attenuation looking different with gamma correction. Assume that light attenuation wants to be linearized before we apply gamma correction.

meow-7.2.2
Geenz 2013-04-18 21:31:10 -04:00
parent 14b807e55e
commit b6a6479c37
6 changed files with 7 additions and 0 deletions

View File

@ -125,6 +125,8 @@ void main()
float fa = light_col[i].a+1.0;
float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
dist_atten = pow(dist_atten, 2.2) * 2.2;
dist_atten *= noise;
float lit = da * dist_atten;

View File

@ -169,6 +169,7 @@ void main()
float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
dist_atten = pow(dist_atten, 2.2) * 2.2;
if (dist_atten <= 0.0)
{
discard;

View File

@ -111,6 +111,7 @@ void main()
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
float fa = falloff+1.0;
float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
dist_atten = pow(dist_atten, 2.2) * 2.2;
float lit = da * dist_atten * noise;
col = color.rgb*lit*col;

View File

@ -175,6 +175,7 @@ void main()
float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
dist_atten = pow(dist_atten, 2.2) * 2.2;
if (dist_atten <= 0.0)
{
discard;

View File

@ -184,6 +184,7 @@ void main()
float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
dist_atten = pow(dist_atten, 2.2) * 2.2;
if (dist_atten <= 0.0)
{
discard;

View File

@ -185,6 +185,7 @@ void main()
float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
dist_atten = pow(dist_atten, 2.2) * 2.2;
if (dist_atten <= 0.0)
{
discard;