summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pohoreski (Ptolemy Linden) <ptolemy@lindenlab.com>2019-11-21 05:25:18 +0000
committerMichael Pohoreski (Ptolemy Linden) <ptolemy@lindenlab.com>2019-11-21 05:25:18 +0000
commite1ea2c2b1eda89cf08fc31d3d1970446daea1883 (patch)
tree6396d3338bf87bdbc76e9d8d67938bbaba9693d6
parent4b205db468fd371dfe1bb30bb887e2ccbd7044ec (diff)
SL-11406 Fix fullbright to better match non-EEP. Minor optimization cleanup.
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl27
1 files changed, 20 insertions, 7 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 9505f2eb74..e640c2d7ae 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -264,8 +264,7 @@ void main()
tnorm = vary_normal;
#endif
- norm.xyz = tnorm;
- norm.xyz = normalize(norm.xyz);
+ norm.xyz = normalize(tnorm.xyz);
vec2 abnormal = encode_normal(norm.xyz);
@@ -277,7 +276,20 @@ void main()
final_color.a = max(final_color.a, emissive_brightness);
- vec4 final_normal = vec4(abnormal, env_intensity, 0.0);
+ // SL-11406 Fullbright: Object > Texture > Shininess > Environment Intensity = 1
+ // NOTE: There are two shaders that are used depending on the EI byte value:
+ // EI = 0 fullbright
+ // EI > 0 .. 255 material
+ // When it is passed to us it is normalized.
+ // We can either modify the output environment intensity
+ // OR
+ // adjust the final color via:
+ // final_color *= 0.666666;
+ // We remap the environment intensity to closely simulate what non-EEP is doing.
+ // At midnight the brightness is exact.
+ // At midday the brightness is very close.
+ float ei = env_intensity*0.5 + 0.5;
+ vec4 final_normal = vec4(abnormal, ei, 0.0);
vec4 final_specular = spec;
final_specular.a = specular_color.a;
@@ -316,11 +328,11 @@ void main()
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float da = dot(normalize(norm.xyz), normalize(light_dir.xyz));
- da = clamp(da, -1.0, 1.0);
+ float da = dot(norm.xyz, normalize(light_dir.xyz));
+ // Dot product is guaranteed to be in -1 <= da <= +1 range for normalized vectors
+ // da = clamp(da, -1.0, 1.0);
- float final_da = da;
- final_da = clamp(final_da, 0.0, 1.0);
+ float final_da = clamp(da, 0.0, 1.0);
float ambient = da;
ambient *= 0.5;
@@ -458,3 +470,4 @@ vec3 post_atmo = color.rgb;
#endif
}
+