diff options
| author | Graham Linden <graham@lindenlab.com> | 2019-04-08 10:34:59 -0700 | 
|---|---|---|
| committer | Graham Linden <graham@lindenlab.com> | 2019-04-08 10:34:59 -0700 | 
| commit | 282f91aaf38cd108ee96475e351623ae203c57a6 (patch) | |
| tree | e1fc9616c7ce204d906dc9de9ed1a256361cc448 /indra/newview/app_settings/shaders | |
| parent | fe589170d3faa5ca681baca7b9a664e2d851cd6e (diff) | |
Make ambient clamping consistent between class1/2 deferred lighting and forward rendering.
Add decls for intermediate lighting values for debug.
Diffstat (limited to 'indra/newview/app_settings/shaders')
6 files changed, 55 insertions, 6 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 6e693bd33b..fb24927b26 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -190,7 +190,7 @@ void main()      calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten); -    vec2 abnormal   = encode_normal(norm.xyz); +    vec2 abnormal = encode_normal(norm.xyz);      vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir;      float da = dot(norm.xyz, light_dir.xyz); @@ -208,15 +208,23 @@ void main()      float ambient = da;      ambient *= 0.5;      ambient *= ambient; -    ambient = max(0.9, ambient); // keeps shadows dark +    ambient = max(0.66, ambient); // keeps shadows dark      ambient = 1.0 - ambient;      vec3 sun_contrib = min(final_da, shadow) * sunlit;      color.rgb *= ambient; + +vec3 post_ambient = color.rgb; +      color.rgb += sun_contrib; + +vec3 post_sunlight = color.rgb; +      color.rgb *= diff.rgb; +vec3 post_diffuse = color.rgb; +      //color.rgb = mix(diff.rgb, color.rgb, final_alpha);      color.rgb = atmosFragLighting(color.rgb, additive, atten); @@ -224,6 +232,8 @@ void main()      vec4 light = vec4(0,0,0,0); +vec3 prelight_linearish_maybe = color.rgb; +     #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diff.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w, shadow);      LIGHT_LOOP(1) @@ -238,13 +248,19 @@ void main()      //      color.rgb += light.rgb; +vec3 postlight_linear = color.rgb; + +color.rgb = prelight_linearish_maybe; +      color.rgb = linear_to_srgb(color.rgb); +  #endif  #ifdef WATER_FOG      color = applyWaterFogView(pos.xyz, color);  #endif +      frag_color = color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 4a47311eb7..4bb01824bf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -305,16 +305,24 @@ void main()      float ambient = da;      ambient *= 0.5;      ambient *= ambient; -    ambient = max(0.9, ambient); +    ambient = max(0.66, ambient);      ambient = 1.0 - ambient;      vec3 sun_contrib = min(final_da, shadow) * sunlit;      col.rgb = amblit;      col.rgb *= ambient; + +vec3 post_ambient = col.rgb; +      col.rgb += sun_contrib; + +vec3 post_sunlight = col.rgb; +      col.rgb *= diffuse.rgb; +vec3 post_diffuse = col.rgb; +      float glare = 0.0;      if (spec.a > 0.0) // specular reflection @@ -363,6 +371,8 @@ vec3 post_spec = col.rgb;      vec3 light = vec3(0,0,0); +    vec3 prelight_linearish_maybe = col.rgb; +   #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w, shadow);          LIGHT_LOOP(1) @@ -375,6 +385,8 @@ vec3 post_spec = col.rgb;      col.rgb += light.rgb; +vec3 postlight_linear = col.rgb; +      glare = min(glare, 1.0);      float al = max(diffcol.a,glare)*vertex_color.a; @@ -384,6 +396,8 @@ vec3 post_spec = col.rgb;      al = temp.a;  #endif +//col.rgb = prelight_linearish_maybe; +      col.rgb = linear_to_srgb(col.rgb);      frag_color.rgb = col.rgb; diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 361ed40eaf..4b9e8290dd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -112,15 +112,24 @@ void main()          float ambient = da;          ambient *= 0.5;          ambient *= ambient; +        ambient = max(0.66, ambient);          ambient = 1.0 - ambient;          vec3 sun_contrib = final_da * sunlit;          col.rgb = amblit;          col.rgb *= ambient; + +vec3 post_ambient = col.rgb; +          col.rgb += sun_contrib; + +vec3 post_sunlight = col.rgb; +          col.rgb *= diffuse.rgb; +vec3 post_diffuse = col.rgb; +          vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));          if (spec.a > 0.0) // specular reflection @@ -168,6 +177,8 @@ void main()              col = fogged.rgb;              bloom = fogged.a;          #endif + +//col.rgb = post_diffuse;      }      frag_color.rgb = col.rgb; diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl index 7d699a4967..4d7cff37c6 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl @@ -34,7 +34,7 @@ vec3 scaleDownLight(vec3 light);  vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)  { -	vec4 col; +	vec4 col = vec4(0);  	col.a = color.a;  	col.rgb = light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 12115082a9..8814587fbc 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -126,16 +126,24 @@ void main()          float ambient = da;          ambient *= 0.5;          ambient *= ambient; -        ambient = max(0.9, ambient); +        ambient = max(0.66, ambient);          ambient = 1.0 - ambient;          vec3 sun_contrib = min(scol, final_da) * sunlit;          col.rgb = amblit;          col.rgb *= ambient; + +vec3 post_ambient = col.rgb; +          col.rgb += sun_contrib; + +vec3 post_sunlight = col.rgb; +          col.rgb *= diffuse.rgb; +vec3 post_diffuse = col.rgb; +          vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));          if (spec.a > 0.0) // specular reflection diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 40c521cd2c..f1398afb99 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -152,7 +152,7 @@ void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit,            + tmpAmbient));      //brightness of surface both sunlight and ambient -    sunlit = vec3(sunlight.rgb* 0.5); +    sunlit = vec3(sunlight.rgb);      amblit = vec3(tmpAmbient * .25);      additive  = normalize(additive);      additive *= vec3(1.0 - exp(-temp2.z * distance_multiplier)) * 0.5; | 
