diff options
Diffstat (limited to 'indra/newview/app_settings/shaders')
6 files changed, 23 insertions, 72 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl index 3c51a8e44c..c8d6e395a3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -29,8 +29,6 @@ out vec4 frag_color; -vec3 fullbrightAtmosTransport(vec3 light); - VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 5515d8e2a3..631ffc9625 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -45,7 +45,8 @@ vec3 srgb_to_linear(vec3 cs); vec3 legacy_adjust_fullbright(vec3 c); vec3 legacy_adjust(vec3 c); vec3 linear_to_srgb(vec3 cl); -vec3 fullbrightAtmosTransport(vec3 light); +vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); +void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); #ifdef HAS_ALPHA_MASK uniform float minimum_alpha; @@ -79,8 +80,18 @@ void main() color.rgb *= vertex_color.rgb; -#ifdef WATER_FOG vec3 pos = vary_position; + +#ifndef IS_HUD + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; + calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); +#endif + +#ifdef WATER_FOG + vec4 fogged = applyWaterFogView(pos, vec4(color.rgb, final_alpha)); color.rgb = fogged.rgb; color.a = fogged.a; @@ -92,7 +103,7 @@ void main() color.rgb = legacy_adjust(color.rgb); color.rgb = srgb_to_linear(color.rgb); color.rgb = legacy_adjust_fullbright(color.rgb); - color.rgb = fullbrightAtmosTransport(color.rgb); + color.rgb = atmosFragLighting(color.rgb, additive, atten); #endif frag_color = max(color, vec4(0)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl index 406a7ef3b3..370aa75d04 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl @@ -23,8 +23,6 @@ * $/LicenseInfo$ */ -/*[EXTRA_CODE_HERE]*/ - out vec4 frag_color; void main() diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl index 3817633df0..689c345b2c 100644 --- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl @@ -125,6 +125,6 @@ vec3 legacy_adjust(vec3 c) vec3 legacy_adjust_fullbright(vec3 c) { float exp_scale = texture(exposureMap, vec2(0.5, 0.5)).r; - return c / exp_scale * 1.34; + return c / exp_scale * 1.34; //magic 1.34 arrived at by binary search for a value that reproduces midpoint grey consistenty } diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl deleted file mode 100644 index 8221ba9516..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @file class2\wl\transportF.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$ - */ - -////////////////////////////////////////////////////////// -// The fragment shader for the terrain atmospherics -////////////////////////////////////////////////////////// - -vec3 getAdditiveColor(); -vec3 getAtmosAttenuation(); - -vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); - -// the below implementations are deprecated but remain here as adapters for shaders that haven't been refactored yet - -vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) -{ - return atmosFragLighting(light, additive, atten); -} - -vec3 atmosTransport(vec3 light) -{ - return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); -} - -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) -{ - return atmosTransportFrag(light, additive, atten); -} - -vec3 fullbrightAtmosTransport(vec3 light) -{ - return atmosTransport(light); -} - -vec3 fullbrightShinyAtmosTransport(vec3 light) -{ - return atmosTransport(light); -} diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index 6b7dc7ac1d..f1b1997c43 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -43,8 +43,9 @@ VARYING vec3 vary_position; uniform samplerCube environmentMap; -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); - +vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); +vec3 legacy_adjust_fullbright(vec3 c); +vec3 legacy_adjust(vec3 c); void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); vec3 linear_to_srgb(vec3 c); @@ -84,10 +85,13 @@ void main() vec3 norm = normalize(vary_texcoord1.xyz); vec4 spec = vec4(0,0,0,0); sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity); - applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity); + color.rgb = legacy_adjust(color.rgb); color.rgb = srgb_to_linear(color.rgb); - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); + color.rgb = legacy_adjust_fullbright(color.rgb); + + applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity); + color.rgb = atmosFragLighting(color.rgb, additive, atten); #endif color.a = 1.0; |