diff options
author | Dave Parks <davep@lindenlab.com> | 2020-03-13 18:12:14 +0000 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2020-03-13 18:12:14 +0000 |
commit | 4034d57bb8ffed4891c5517c94fd4ccb10a41160 (patch) | |
tree | d5b85cdeb6eb48f7496cadca3002cce3d9b6c69c /indra/newview/app_settings/shaders | |
parent | f840297e3daf6f4d42eae383da52aeabec4bb7a6 (diff) | |
parent | 0a0cfcf2ef92375f099ed91f009db1ebf2d410c0 (diff) |
Merged in davep/DRTVWR-440 (pull request #33)
SL-12233 Fix for disagreement between fullbright implementations with ALM on and off.
Diffstat (limited to 'indra/newview/app_settings/shaders')
5 files changed, 28 insertions, 13 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 553c2f3045..ca11f58888 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; diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index 8fc5d750e3..f69d36f715 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -49,10 +49,15 @@ vec3 atmosTransport(vec3 light) return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } -vec3 fullbrightAtmosTransport(vec3 light) +vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { float brightness = dot(light.rgb * 0.5, vec3(0.3333)) + 0.1; - return atmosTransportFrag(light * 0.5, getAdditiveColor() * brightness, getAtmosAttenuation()); + return atmosTransportFrag(light * 0.5, additive * brightness, atten); +} + +vec3 fullbrightAtmosTransport(vec3 light) +{ + return fullbrightAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } vec3 fullbrightShinyAtmosTransport(vec3 light) diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl index 18705f785f..aa7dbc39ce 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl @@ -49,10 +49,15 @@ vec3 atmosTransport(vec3 light) return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } -vec3 fullbrightAtmosTransport(vec3 light) +vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { float brightness = dot(light.rgb, vec3(0.33333)); - return atmosTransportFrag(light * 0.5, getAdditiveColor() * (brightness * 0.5 + 0.5), getAtmosAttenuation()); + return atmosTransportFrag(light * 0.5, additive * (brightness * 0.5 + 0.5), atten); +} + +vec3 fullbrightAtmosTransport(vec3 light) +{ + return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } vec3 fullbrightShinyAtmosTransport(vec3 light) |