diff options
author | Runitai Linden <davep@lindenlab.com> | 2020-03-13 12:58:47 -0500 |
---|---|---|
committer | Runitai Linden <davep@lindenlab.com> | 2020-03-13 12:58:47 -0500 |
commit | 0a0cfcf2ef92375f099ed91f009db1ebf2d410c0 (patch) | |
tree | 427af0404ca8721fc763d4eeb77a9dc6e36dd1b0 /indra/newview/app_settings/shaders/class1 | |
parent | 56dcbc3cf1d76a4f3f8a6b3c18aa20e29a5e72d7 (diff) |
SL-12233 Fix for disagreement between fullbright implementations with ALM on and off.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
3 files changed, 14 insertions, 9 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl index 0ffca8515c..f0522850de 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -44,7 +44,6 @@ void main() float shadow = 1.0; vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; - color.rgb = pow(color.rgb, vec3(2.2)); color.rgb = fullbrightAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index c104dc884f..46ec20c8b0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -79,11 +79,9 @@ void main() color.rgb = fogged.rgb; color.a = fogged.a; #else - color.rgb = srgb_to_linear(color.rgb); - color.rgb = fullbrightAtmosTransport(color.rgb); + color.rgb = fullbrightAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - color.rgb = linear_to_srgb(color.rgb); - color.a = final_alpha; + color.a = final_alpha; #endif frag_color.rgb = color.rgb; diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 5999063ae5..a69653fe4e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -44,6 +44,9 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); vec3 scaleSoftClipFrag(vec3 l); +vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); +vec3 fullbrightScaleSoftClip(vec3 light); + void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); vec3 srgb_to_linear(vec3 cs); @@ -320,21 +323,26 @@ void main() vec3 atten; calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false); - + if (emissive_brightness >= 1.0) // fullbright, skip lighting calculations { - // just do atmos attenuation (ad hoc 60% factor to match release viewer) - color = atmosFragLighting(diffuse_srgb.rgb, additive, atten*0.6); - color = scaleSoftClipFrag(color); + color = fullbrightAtmosTransportFrag(diffuse_srgb.rgb, additive, atten); + color = fullbrightScaleSoftClip(color); + al = diffuse_srgb.a; } else // not fullbright, calculate lighting { vec3 refnormpersp = normalize(reflect(pos.xyz, norm)); + //we're in sRGB space, so gamma correct this dot product so + // lighting from the sun stays sharp float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); da = pow(da, 1.0 / 1.3); + //darken ambient for normals perpendicular to light vector so surfaces in shadow + // and facing away from light still have some definition to them. + // do NOT gamma correct this dot product so ambient lighting stays soft float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; |