From cf3b7bbe4b932b683d0d30c95505f45d16a1d2a7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Jul 2013 12:59:29 -0500 Subject: NORSPEC-298 Fix for inconsistent alpha lighting when diffuse color is not white. --- .../app_settings/shaders/class1/deferred/alphaF.glsl | 4 +++- .../app_settings/shaders/class1/deferred/alphaV.glsl | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'indra/newview/app_settings/shaders/class1') diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index e80e4b0fcf..640e273415 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -61,6 +61,7 @@ VARYING vec3 vary_directional; VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_pointlight_col; +VARYING vec3 vary_pointlight_col_linear; VARYING vec2 vary_texcoord0; VARYING vec3 vary_norm; @@ -228,6 +229,7 @@ void main() { shadow = 1.0; } + #endif #ifdef USE_INDEXED_TEX @@ -276,7 +278,7 @@ void main() LIGHT_LOOP(6) LIGHT_LOOP(7) - color.rgb += diff.rgb * srgb_to_linear(vary_pointlight_col) * col.rgb; + color.rgb += diff.rgb * vary_pointlight_col_linear * col.rgb; color.rgb = linear_to_srgb(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 9d3ba564cd..6b5b54b863 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -68,6 +68,7 @@ VARYING vec3 vary_directional; VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_pointlight_col; +VARYING vec3 vary_pointlight_col_linear; #ifdef USE_VERTEX_COLOR VARYING vec4 vertex_color; @@ -86,6 +87,16 @@ uniform vec3 light_diffuse[8]; uniform vec3 sun_dir; +vec3 srgb_to_linear(vec3 cs) +{ + +/* { cs / 12.92, cs <= 0.04045 + cl = { + { ((cs + 0.055)/1.055)^2.4, cs > 0.04045*/ + + return pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4)); +} + vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) { //get light vector @@ -178,10 +189,8 @@ void main() vec3 diff = diffuse_color.rgb; - - vary_pointlight_col = diff; - + vary_pointlight_col_linear = srgb_to_linear(diff); col.rgb = vec3(0,0,0); -- cgit v1.2.3