diff options
author | Graham Linden <graham@lindenlab.com> | 2018-12-05 13:08:06 -0800 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-12-05 13:08:06 -0800 |
commit | 26c1430a04de585c1823569b60dc99abc798231b (patch) | |
tree | dc0aed98b3d7faecd31f1f327ff769f7c1f8c1be /indra/newview/app_settings | |
parent | b6fa72d3c4d02527f6d118eadc9ba1ac48a297f5 (diff) |
Shader cleanup and consolidation of use of sRGB conversion funcs.
Diffstat (limited to 'indra/newview/app_settings')
18 files changed, 59 insertions, 196 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 07b0f2a98a..5e3c767460 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -84,11 +84,8 @@ uniform vec3 light_diffuse[8]; vec4 applyWaterFogView(vec3 pos, vec4 color); #endif -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); vec2 encode_normal (vec3 n); vec3 decode_normal (vec2 enc); - vec3 scaleSoftClip(vec3 l); vec3 atmosFragAmbient(vec3 light, vec3 sunlit); vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); @@ -162,7 +159,8 @@ void main() frag *= screen_res; vec4 pos = vec4(vary_position, 1.0); - + vec3 norm = vary_norm; + float shadow = 1.0; #if HAS_SHADOW @@ -265,17 +263,10 @@ void main() float final_alpha = diff.a; #endif - - vec4 gamma_diff = diff; - diff.rgb = srgb_to_linear(diff.rgb); - - vec3 norm = vary_norm; - - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten); vec2 abnormal = encode_normal(norm.xyz); @@ -287,7 +278,7 @@ void main() float final_da = max(sun_da, moon_da); final_da = min(final_da, shadow); final_da = clamp(final_da, 0.0f, 1.0f); - final_da = pow(final_da, 1.0/1.3); + final_da = pow(final_da, display_gamma); vec4 color = vec4(0,0,0,0); @@ -300,8 +291,8 @@ void main() ambient = (1.0-ambient); color.rgb *= ambient; - color.rgb += atmosFragAffectDirectionalLight(final_da, sunlit); - color.rgb *= gamma_diff.rgb; + color.rgb += (final_da * sunlit); + color.rgb *= diff.rgb; //color.rgb = mix(diff.rgb, color.rgb, final_alpha); @@ -310,8 +301,6 @@ void main() vec4 light = vec4(0,0,0,0); - color.rgb = srgb_to_linear(color.rgb); - #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diff.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); LIGHT_LOOP(1) @@ -326,10 +315,6 @@ void main() // color.rgb += light.rgb; - // straight to display gamma, we're post-deferred - // - color.rgb = linear_to_srgb(color.rgb); - #ifdef WATER_FOG color = applyWaterFogView(pos.xyz, color); #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 0e21e5925d..2db737a427 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -45,9 +45,6 @@ VARYING vec2 vary_texcoord0; vec4 applyWaterFogView(vec3 pos, vec4 color); #endif -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); - vec3 fullbrightAtmosTransportDeferred(vec3 light) { return light; @@ -81,12 +78,9 @@ void main() #endif color.rgb *= vertex_color.rgb; - color.rgb = srgb_to_linear(color.rgb); color.rgb = fullbrightAtmosTransportDeferred(color.rgb); color.rgb = fullbrightScaleSoftClipDeferred(color.rgb); - color.rgb = linear_to_srgb(color.rgb); - #ifdef WATER_FOG vec3 pos = vary_position; vec4 fogged = applyWaterFogView(pos, vec4(color.rgb, final_alpha)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index 6ba16b169c..d29e8a9423 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -40,8 +40,6 @@ uniform sampler2D specularMap; VARYING vec2 vary_texcoord0; -vec3 linear_to_srgb(vec3 cl); - void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); @@ -54,8 +52,6 @@ void main() vec4 norm = texture2D(normalMap, vary_texcoord0.xy); vec4 spec = texture2D(specularMap, vary_texcoord0.xy); - col.rgb = linear_to_srgb(col.rgb); - frag_data[0] = vec4(col.rgb, 0.0); frag_data[1] = spec; frag_data[2] = vec4(norm.xy,0,0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 7d5ae7c2e7..211bedee59 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -37,10 +37,6 @@ uniform float display_gamma; vec4 applyWaterFogView(vec3 pos, vec4 color); #endif -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); - -vec3 atmosFragAmbient(vec3 l, vec3 ambient); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); vec3 scaleSoftClipFrag(vec3 l); @@ -234,6 +230,8 @@ vec3 decode_normal (vec2 enc); void main() { + vec2 pos_screen = vary_texcoord0.xy; + vec4 diffcol = texture2D(diffuseMap, vary_texcoord0.xy); diffcol.rgb *= vertex_color.rgb; @@ -246,7 +244,6 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) vec3 gamma_diff = diffcol.rgb; - diffcol.rgb = srgb_to_linear(diffcol.rgb); #endif #if HAS_SPECULAR_MAP @@ -390,9 +387,9 @@ void main() //final_da = max(final_da, diffuse.a); final_da = max(final_da, 0.0f); final_da = min(final_da, 1.0f); - final_da = pow(final_da, 1.0/1.3); + final_da = pow(final_da, display_gamma); - col.rgb = atmosFragAmbient(col, amblit); + col.rgb = (col * 0.5) + amblit; float ambient = min(abs(final_da), 1.0); ambient *= 0.5; @@ -446,14 +443,7 @@ void main() glare += cur_glare; } - //col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a); - //col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); - col = atmosFragLighting(col, additive, atten); - col = scaleSoftClipFrag(col); - - //convert to linear space before adding local lights - col = srgb_to_linear(col); vec3 npos = normalize(-pos.xyz); @@ -474,8 +464,7 @@ void main() glare = min(glare, 1.0); float al = max(diffcol.a,glare)*vertex_color.a; - //convert to gamma space for display on screen - col.rgb = linear_to_srgb(col.rgb); + col = scaleSoftClipFrag(col); #ifdef WATER_FOG vec4 temp = applyWaterFogView(pos, vec4(col.rgb, al)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 1d75322b4c..b3dcd90d98 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -73,13 +73,10 @@ uniform vec2 screen_res; uniform mat4 inv_proj; vec3 decode_normal (vec2 enc); -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -99,7 +96,6 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -117,7 +113,6 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = tc-vec2(0.5); diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index 8791469675..0b943d2527 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -40,12 +40,10 @@ VARYING vec2 vary_fragcoord; uniform float display_gamma; -vec3 linear_to_srgb(vec3 cl); - void main() { - vec4 diff = texture2DRect(diffuseRect, vary_fragcoord); + vec4 diff = texture2DRect(diffuseRect, vary_fragcoord); diff.rgb = pow(diff.rgb, vec3(display_gamma)); - frag_color = diff; + 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 41eb06126b..2ba766a0c4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -66,10 +66,7 @@ uniform vec2 screen_res; vec4 applyWaterFogView(vec3 pos, vec4 color); #endif -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); vec3 decode_normal (vec2 enc); - vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); vec3 fullbrightAtmosTransportFrag(vec3 l, vec3 additive, vec3 atten); void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); @@ -114,13 +111,10 @@ void main() vec4 diffuse = texture2DRect(diffuseRect, tc); - //convert to gamma space - //diffuse.rgb = linear_to_srgb(diffuse.rgb); - - vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); - vec3 col; - float bloom = 0.0; - { + vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); + vec3 col; + float bloom = 0.0; + { vec3 sunlit; vec3 amblit; vec3 additive; @@ -168,18 +162,14 @@ void main() col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); } - #ifdef WATER_FOG - vec4 fogged = applyWaterFogView(pos.xyz,vec4(col, bloom)); - col = fogged.rgb; - bloom = fogged.a; - #endif - - //col = srgb_to_linear(col); - //col = vec3(1,0,1); - //col.g = envIntensity; - } + #ifdef WATER_FOG + vec4 fogged = applyWaterFogView(pos.xyz,vec4(col, bloom)); + col = fogged.rgb; + bloom = fogged.a; + #endif + } - frag_color.rgb = col.rgb; - frag_color.a = bloom; + frag_color.rgb = col.rgb; + frag_color.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 2b6428963d..1abdd4af33 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -71,18 +71,10 @@ uniform vec2 screen_res; uniform mat4 inv_proj; vec3 decode_normal (vec2 enc); -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); - -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.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -102,7 +94,6 @@ 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); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -120,7 +111,6 @@ 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); vec2 dist = tc-vec2(0.5); diff --git a/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl b/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl deleted file mode 100644 index bc3324f543..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file srgb.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -vec3 rgb2hsv(vec3 c) -{ - vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); - vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); - vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); - - float d = q.x - min(q.w, q.y); - float e = 1.0e-10; - return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); -} - -vec3 hsv2rgb(vec3 c) -{ - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); -} - -vec3 srgb_to_linear(vec3 cs) -{ - vec3 low_range = cs / vec3(12.92); - vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4)); - - bvec3 lte = lessThanEqual(cs,vec3(0.04045)); - return mix(high_range, low_range, lte); -} - -vec3 linear_to_srgb(vec3 cl) -{ - cl = clamp(cl, vec3(0), vec3(1)); - vec3 low_range = cl * 12.92; - vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055; - - bvec3 lt = lessThan(cl,vec3(0.0031308)); - return mix(high_range, low_range, lt); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl index db1eab23fb..e95a688e1f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl @@ -58,9 +58,6 @@ VARYING vec4 refCoord; VARYING vec4 littleWave; VARYING vec4 view; -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); - vec2 encode_normal(vec3 n); vec4 applyWaterFog(vec4 color, vec3 viewVec) diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index 69543b93ea..9da2548586 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -62,7 +62,6 @@ VARYING vec4 littleWave; VARYING vec4 view; VARYING vec4 vary_position; -vec3 srgb_to_linear(vec3 cs); vec2 encode_normal(vec3 n); vec3 scaleSoftClipFrag(vec3 l); diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl index f98b3a5edf..4a8b892c3a 100644 --- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl @@ -64,3 +64,21 @@ vec3 ColorFromRadiance(vec3 radiance) { return vec3(1.0) - exp(-radiance * 0.0001); } + +vec3 rgb2hsv(vec3 c) +{ + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +vec3 hsv2rgb(vec3 c) +{ + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl index 8b7c4f2ecf..4f0e2a6cb6 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl @@ -1,5 +1,5 @@ /** - * @file atmosphericsF.glsl + * @file class1\windlight\atmosphericsF.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 864ba4859d..0a8981a102 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -71,19 +71,11 @@ uniform vec2 screen_res; uniform mat4 inv_proj; -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); vec3 decode_normal (vec2 enc); -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.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -103,7 +95,6 @@ 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); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -121,7 +112,6 @@ 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); vec2 dist = tc-vec2(0.5); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 184ac13b27..9de2741725 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -74,8 +74,6 @@ VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); vec3 decode_normal (vec2 enc); void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); @@ -124,13 +122,10 @@ void main() float da = max(da_sun, da_moon); da = clamp(da, 0.0, 1.0); - da = pow(da, global_gamma); - - vec4 diffuse = texture2DRect(diffuseRect, tc); - - //convert to gamma space - //diffuse.rgb = linear_to_srgb(diffuse.rgb); + da = pow(da, global_gamma); + vec4 diffuse = texture2DRect(diffuseRect, tc); + vec3 col; float bloom = 0.0; { @@ -195,9 +190,6 @@ void main() col = fogged.rgb; bloom = fogged.a; #endif - - //col = srgb_to_linear(col); - } frag_color.rgb = col; frag_color.a = bloom; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl index c840d72784..8b8b338f68 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl @@ -36,7 +36,5 @@ void main() //transform vertex vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); gl_Position = pos; - - vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index a7da140b31..d97bd936d9 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -72,18 +72,10 @@ uniform vec2 screen_res; uniform mat4 inv_proj; vec3 decode_normal (vec2 enc); -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); - -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.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -103,7 +95,6 @@ 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); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -121,7 +112,6 @@ 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); vec2 dist = tc-vec2(0.5); diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl index 9c050256dc..90ab5d2793 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl @@ -61,14 +61,17 @@ vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); } -vec3 atmosTransport(vec3 light) { - return (no_atmo == 1) ? light : atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); +vec3 atmosTransport(vec3 light) +{ + return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } -vec3 fullbrightAtmosTransport(vec3 light) { - return (no_atmo == 1) ? light : fullbrightAtmosTransportFrag(light, GetAdditiveColor(), getAtmosAttenuation()); +vec3 fullbrightAtmosTransport(vec3 light) +{ + return fullbrightAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } -vec3 fullbrightShinyAtmosTransport(vec3 light) { - return (no_atmo == 1) ? light : fullbrightShinyAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); +vec3 fullbrightShinyAtmosTransport(vec3 light) +{ + return fullbrightShinyAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } |