From db091d23db70952b4ad8b610ef02942a8f13f223 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 22 May 2019 11:00:30 -0700 Subject: SL-10969 Fix linear attenuation on forward projector lighting. Revert setup of falloff to prev code. Revert deferred water spec and tweak refl/refr blend. --- .../shaders/class2/deferred/multiSpotLightF.glsl | 16 ++++------------ .../shaders/class2/deferred/spotLightF.glsl | 19 +++++++------------ 2 files changed, 11 insertions(+), 24 deletions(-) (limited to 'indra/newview/app_settings/shaders/class2/deferred') diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 54ec534d14..bc879948e4 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -72,20 +72,12 @@ uniform vec2 screen_res; uniform mat4 inv_proj; vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); - vec3 getNorm(vec2 pos_screen); - -vec4 correctWithGamma(vec4 col) -{ - return vec4(srgb_to_linear(col.rgb), col.a); -} - vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret = correctWithGamma(ret); + ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); float det = min(lod/(proj_lod*0.5), 1.0); @@ -104,7 +96,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret = correctWithGamma(ret); + ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -122,7 +114,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret = correctWithGamma(ret); + ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = tc-vec2(0.5); @@ -295,7 +287,7 @@ void main() //not sure why, but this line prevents MATBUG-194 col = max(col, vec3(0.0)); - +//col.rgb = vec3(0); frag_color.rgb = col; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 2ef7cffe9d..43f283bede 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -73,15 +73,11 @@ uniform mat4 inv_proj; vec3 getNorm(vec2 pos_screen); vec3 srgb_to_linear(vec3 c); -vec4 correctWithGamma(vec4 col) -{ - return vec4(srgb_to_linear(col.rgb), col.a); -} vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret = correctWithGamma(ret); + ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -101,7 +97,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret = correctWithGamma(ret); + ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -119,7 +115,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret = correctWithGamma(ret); + ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = tc-vec2(0.5); @@ -174,8 +170,8 @@ void main() proj_tc.xyz /= proj_tc.w; - float fa = falloff + 1.0; - float dist_atten = min(1.0 - (dist - 1.0 * (1.0 - fa)) / fa, 1.0); + float fa = falloff+1.0; + float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0); dist_atten *= dist_atten; dist_atten *= 2.0; @@ -187,8 +183,7 @@ void main() lv = proj_origin-pos.xyz; lv = normalize(lv); float da = dot(norm, lv); - da = clamp(da, 0.0, 1.0); - + vec3 col = vec3(0,0,0); vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; @@ -294,7 +289,7 @@ void main() //not sure why, but this line prevents MATBUG-194 col = max(col, vec3(0.0)); - +//col.rgb = vec3(0); frag_color.rgb = col; frag_color.a = 0.0; } -- cgit v1.2.3