summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2013-07-24 04:03:27 -0700
committerGraham Linden <graham@lindenlab.com>2013-07-24 04:03:27 -0700
commite290dd3fa175c2a891cc4f4e0c401edb10cedfb4 (patch)
tree2a542af707196211e78051cbb8a75a1a1583538d /indra/newview/app_settings/shaders/class1/deferred
parent72a0ae58e909b017c07e543bc99adc1db5e89180 (diff)
NORSPEC-311 make post deferred (alpha objects) respect same gamma ramp as deferred (opaque objects)
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/alphaF.glsl11
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl8
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl9
5 files changed, 33 insertions, 9 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index b928761358..e836e9750f 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -35,6 +35,8 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
+uniform float display_gamma;
+
#if HAS_SHADOW
uniform sampler2DShadow shadowMap0;
uniform sampler2DShadow shadowMap1;
@@ -204,6 +206,11 @@ vec3 linear_to_srgb(vec3 cl)
cs = { 1.055 * cl^0.41666 - 0.055, 0.0031308 <= cl < 1
{ 1.0, cl >= 1*/
+ cl = clamp(cl, vec3(0), vec3(1));
+
+ if ((cl.r+cl.g+cl.b) < 0.0031308)
+ return 12.92 * cl;
+
return 1.055 * pow(cl, vec3(0.41666)) - 0.055;
}
@@ -295,7 +302,7 @@ void main()
#ifdef USE_VERTEX_COLOR
float vertex_color_alpha = diff.a * vertex_color.a;
#else
- float vertex_color_alpha = 1.0;
+ float vertex_color_alpha = diff.a;
#endif
vec3 normal = vary_norm;
@@ -333,7 +340,7 @@ void main()
color.rgb += diff.rgb * vary_pointlight_col_linear * col.rgb;
- color.rgb = linear_to_srgb(color.rgb);
+ color.rgb = pow(color.rgb,vec3(display_gamma));
#ifdef WATER_FOG
color = applyWaterFogDeferred(pos.xyz, color);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index da2585f662..da4ebfea58 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -117,6 +117,11 @@ vec3 linear_to_srgb(vec3 cl)
cs = { 1.055 * cl^0.41666 - 0.055, 0.0031308 <= cl < 1
{ 1.0, cl >= 1*/
+ cl = clamp(cl, vec3(0), vec3(1));
+
+ if ((cl.r+cl.g+cl.b) < 0.0031308)
+ return 12.92 * cl;
+
return 1.055 * pow(cl, vec3(0.41666)) - 0.055;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index e028eef900..a46fbd9516 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -53,6 +53,11 @@ vec3 linear_to_srgb(vec3 cl)
cs = { 1.055 * cl^0.41666 - 0.055, 0.0031308 <= cl < 1
{ 1.0, cl >= 1*/
+ cl = clamp(cl, vec3(0), vec3(1));
+
+ if ((cl.r+cl.g+cl.b) < 0.0031308)
+ return 12.92 * cl;
+
return 1.055 * pow(cl, vec3(0.41666)) - 0.055;
}
@@ -701,7 +706,7 @@ void main()
col += spec_contrib;
}
- col = mix(col.rgb, old_diffcol.rgb, diffuse.a);
+ col = mix(col.rgb, diffcol.rgb, diffuse.a);
if (envIntensity > 0.0)
{
@@ -754,7 +759,7 @@ void main()
frag_color.a = al;
#else
- //final_color.rgb = vec3(1,0,1);
+ //final_color.rgb = old_diffcol.rgb;
frag_data[0] = final_color;
frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent.
frag_data[2] = final_normal; // XY = Normal. Z = Env. intensity.
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 59b027a045..01f9d99682 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -36,7 +36,7 @@ uniform sampler2DRect diffuseRect;
uniform vec2 screen_res;
VARYING vec2 vary_fragcoord;
-uniform float texture_gamma;
+uniform float display_gamma;
vec3 linear_to_srgb(vec3 cl)
{
@@ -45,13 +45,17 @@ vec3 linear_to_srgb(vec3 cl)
cs = { 1.055 * cl^0.41666 - 0.055, 0.0031308 <= cl < 1
{ 1.0, cl >= 1*/
+ cl = clamp(cl, vec3(0), vec3(1));
+
+ if ((cl.r+cl.g+cl.b) < 0.0031308)
+ return 12.92 * cl;
return 1.055 * pow(cl, vec3(0.41666)) - 0.055;
}
void main()
{
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
- diff.rgb = pow(diff.rgb,vec3(texture_gamma));
+ diff.rgb = pow(diff.rgb,vec3(display_gamma));
frag_color = diff;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 6f11e8427c..045b449bbf 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -101,6 +101,11 @@ vec3 linear_to_srgb(vec3 cl)
cs = { 1.055 * cl^0.41666 - 0.055, 0.0031308 <= cl < 1
{ 1.0, cl >= 1*/
+ cl = clamp(cl, vec3(0), vec3(1));
+
+ if ((cl.r+cl.g+cl.b) < 0.0031308)
+ return 12.92 * cl;
+
return 1.055 * pow(cl, vec3(0.41666)) - 0.055;
}
@@ -403,9 +408,7 @@ void main()
ambient = (1.0-ambient);
col.rgb *= ambient;
-
- col += atmosAffectDirectionalLight(max(min(da, 1.0), 0.0));
-
+ col += atmosAffectDirectionalLight(max(min(da, 1.0), 0.0));
col *= diffuse.rgb;
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));