summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl139
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl40
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl25
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl40
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/skyF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl117
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl117
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/skyF.glsl19
24 files changed, 281 insertions, 334 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
index b7036e02cf..8e0a001403 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file WLCloudsV.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, 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$
*/
@@ -33,26 +33,26 @@ ATTRIBUTE vec2 texcoord0;
///////////////////////////////////////////////////////////////////////////////
// Output parameters
-VARYING vec4 vary_CloudColorSun;
-VARYING vec4 vary_CloudColorAmbient;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
VARYING float vary_CloudDensity;
-VARYING vec2 vary_texcoord0;
-VARYING vec2 vary_texcoord1;
-VARYING vec2 vary_texcoord2;
-VARYING vec2 vary_texcoord3;
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
VARYING float altitude_blend_factor;
// Inputs
uniform vec3 camPosLocal;
-uniform vec4 lightnorm;
-uniform vec4 sunlight_color;
-uniform vec4 moonlight_color;
-uniform int sun_up_factor;
-uniform vec4 ambient_color;
-uniform vec4 blue_horizon;
-uniform vec4 blue_density;
+uniform vec4 lightnorm;
+uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
+uniform vec4 ambient_color;
+uniform vec4 blue_horizon;
+uniform vec4 blue_density;
uniform float haze_horizon;
uniform float haze_density;
@@ -60,7 +60,7 @@ uniform float cloud_shadow;
uniform float density_multiplier;
uniform float max_y;
-uniform vec4 glow;
+uniform vec4 glow;
uniform float sun_moon_glow_factor;
uniform vec4 cloud_color;
@@ -75,53 +75,53 @@ uniform float cloud_scale;
// indra\newview\llsettingsvo.cpp
void main()
{
- // World / view / projection
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ // World / view / projection
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- // Texture coords
+ // Texture coords
// SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
vary_texcoord0 = vec2(-texcoord0.x, texcoord0.y); // See: LLSettingsVOSky::applySpecial
- vary_texcoord0.xy -= 0.5;
- vary_texcoord0.xy /= cloud_scale;
- vary_texcoord0.xy += 0.5;
+ vary_texcoord0.xy -= 0.5;
+ vary_texcoord0.xy /= cloud_scale;
+ vary_texcoord0.xy += 0.5;
- vary_texcoord1 = vary_texcoord0;
- vary_texcoord1.x += lightnorm.x * 0.0125;
- vary_texcoord1.y += lightnorm.z * 0.0125;
+ vary_texcoord1 = vary_texcoord0;
+ vary_texcoord1.x += lightnorm.x * 0.0125;
+ vary_texcoord1.y += lightnorm.z * 0.0125;
- vary_texcoord2 = vary_texcoord0 * 16.;
- vary_texcoord3 = vary_texcoord1 * 16.;
+ vary_texcoord2 = vary_texcoord0 * 16.;
+ vary_texcoord3 = vary_texcoord1 * 16.;
- // Get relative position
+ // Get relative position
vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);
altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0);
- // Set altitude
+ // Set altitude
if (rel_pos.y > 0)
- {
+ {
rel_pos *= (max_y / rel_pos.y);
- }
+ }
if (rel_pos.y < 0)
- {
- altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon
+ {
+ altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon
rel_pos *= (-32000. / rel_pos.y);
- }
+ }
- // Can normalize then
+ // Can normalize then
vec3 rel_pos_norm = normalize(rel_pos);
float rel_pos_len = length(rel_pos);
- // Initialize temp variables
- vec4 sunlight = sunlight_color;
- vec4 light_atten;
+ // Initialize temp variables
+ vec4 sunlight = sunlight_color;
+ vec4 light_atten;
- // Sunlight attenuation effect (hue and brightness) due to atmosphere
- // this is used later for sunlight modulation at various altitudes
+ // Sunlight attenuation effect (hue and brightness) due to atmosphere
+ // this is used later for sunlight modulation at various altitudes
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
- // Calculate relative weights
+ // Calculate relative weights
vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density));
vec4 blue_weight = blue_density / combined_haze;
vec4 haze_weight = haze_density / combined_haze;
@@ -130,63 +130,64 @@ void main()
float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);
sunlight *= exp(-light_atten * off_axis);
- // Distance
+ // Distance
float density_dist = rel_pos_len * density_multiplier;
// Transparency (-> combined_haze)
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
- // compiler gets confused.
+ // compiler gets confused.
combined_haze = exp(-combined_haze * density_dist);
- // Compute haze glow
+ // Compute haze glow
float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);
// haze_glow is 0 at the sun and increases away from sun
haze_glow = max(haze_glow, .001);
- // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
+ // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
haze_glow *= glow.x;
- // Higher glow.x gives dimmer glow (because next step is 1 / "angle")
+ // Higher glow.x gives dimmer glow (because next step is 1 / "angle")
haze_glow = pow(haze_glow, glow.z);
- // glow.z should be negative, so we're doing a sort of (1 / "angle") function
+ // glow.z should be negative, so we're doing a sort of (1 / "angle") function
haze_glow *= sun_moon_glow_factor;
- // Add "minimum anti-solar illumination"
+ // Add "minimum anti-solar illumination"
// For sun, add to glow. For moon, remove glow entirely. SL-13768
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25);
- // Increase ambient when there are more clouds
- vec4 tmpAmbient = ambient_color;
- tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
+ // Increase ambient when there are more clouds
+ vec4 tmpAmbient = ambient_color;
+ tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
- // Dim sunlight by cloud shadow percentage
- sunlight *= (1. - cloud_shadow);
+ // Dim sunlight by cloud shadow percentage
+ sunlight *= (1. - cloud_shadow);
- // Haze color below cloud
+ // Haze color below cloud
vec4 additiveColorBelowCloud =
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
- // CLOUDS
+ // CLOUDS
+ sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP
off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);
sunlight *= exp(-light_atten * off_axis);
- // Cloud color out
+ // Cloud color out
vary_CloudColorSun = (sunlight * haze_glow) * cloud_color;
- vary_CloudColorAmbient = tmpAmbient * cloud_color;
-
- // Attenuate cloud color by atmosphere
+ vary_CloudColorAmbient = tmpAmbient * cloud_color;
+
+ // Attenuate cloud color by atmosphere
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
vary_CloudColorSun *= combined_haze;
vary_CloudColorAmbient *= combined_haze;
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze);
- // Make a nice cloud density based on the cloud_shadow value that was passed in.
- vary_CloudDensity = 2. * (cloud_shadow - 0.25);
+ // Make a nice cloud density based on the cloud_shadow value that was passed in.
+ vary_CloudDensity = 2. * (cloud_shadow - 0.25);
- // Combine these to minimize register use
- vary_CloudColorAmbient += oHazeColorBelowCloud;
+ // Combine these to minimize register use
+ vary_CloudColorAmbient += oHazeColorBelowCloud;
- // needs this to compile on mac
- // vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
+ // needs this to compile on mac
+ //vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
- // END CLOUDS
+ // END CLOUDS
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl
index 6b36d00f97..9fcee04c32 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl
@@ -64,28 +64,27 @@ void main()
#else
vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);
#endif
-
+
color.rgb *= vertex_color.rgb;
// SL-9632 HUDs are affected by Atmosphere
if (no_atmo == 0)
{
- vec3 sunlit;
- vec3 amblit;
- vec3 additive;
- vec3 atten;
+ vec3 sunlit;
+ vec3 amblit;
+ vec3 additive;
+ vec3 atten;
vec3 pos = vary_position.xyz/vary_position.w;
- calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false);
-
- vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
- float env_intensity = vertex_color.a;
+ calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false);
+
+ vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
+ float env_intensity = vertex_color.a;
//color.rgb = srgb_to_linear(color.rgb);
color.rgb = mix(color.rgb, envColor.rgb, env_intensity);
-
- color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten);
- color.rgb = fullbrightScaleSoftClip(color.rgb);
+ color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten);
+ color.rgb = fullbrightScaleSoftClip(color.rgb);
}
/*
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index d29e8a9423..eb6e56e718 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -40,6 +40,8 @@ uniform sampler2D specularMap;
VARYING vec2 vary_texcoord0;
+vec3 linear_to_srgb(vec3 c);
+
void main()
{
vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
@@ -52,6 +54,7 @@ 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 80d19102b6..e1f7031af6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -406,6 +406,8 @@ void main()
vec3 light = vec3(0, 0, 0);
+ final_specular.rgb = srgb_to_linear(final_specular.rgb); // SL-14035
+
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w );
LIGHT_LOOP(1)
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index 8c402fcb54..09c47165dd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -73,9 +73,7 @@ void main()
vec3 norm = getNorm(frag.xy);
vec4 spec = texture2DRect(specularRect, frag.xy);
- spec.rgb = srgb_to_linear(spec.rgb);
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
- diff.rgb = srgb_to_linear(diff.rgb);
float noise = texture2D(noiseMap, frag.xy / 128.0).b;
vec3 npos = normalize(-pos);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 9bba45bc4e..ec3fb9c543 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -182,10 +182,6 @@ void main()
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
- // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space.
- // We can't switch to linear here unless we do it everywhere*
- // *gbuffer is sRGB, convert to linear whenever sampling from it
- diff_tex.rgb = srgb_to_linear(diff_tex.rgb);
vec3 dlit = vec3(0, 0, 0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index d805c9ea48..18616a9bb3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -90,7 +90,6 @@ void main()
float noise = texture2D(noiseMap, frag.xy/128.0).b;
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
- col.rgb = srgb_to_linear(col.rgb);
float fa = falloff+1.0;
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
@@ -127,7 +126,7 @@ void main()
{
discard;
}
-//col.rgb = vec3(0);
+
frag_color.rgb = col;
frag_color.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index f80f1a985a..7f2c603f87 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -90,7 +90,7 @@ void main()
vec4 diffuse = texture2DRect(diffuseRect, tc);
//convert to gamma space
- //diffuse.rgb = linear_to_srgb(diffuse.rgb);
+ diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
vec3 color = vec3(0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
index 454af2a9bc..b2fa5d8a25 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
@@ -49,10 +49,6 @@ void main()
vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(sunDiscA, sunDiscB, blend_factor);
- c.rgb = srgb_to_linear(c.rgb);
- c.rgb = clamp(c.rgb, vec3(0), vec3(1));
- c.rgb = pow(c.rgb, vec3(0.7f));
-
//c.rgb = fullbrightAtmosTransport(c.rgb);
c.rgb = fullbrightScaleSoftClip(c.rgb);
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
index 6f7e777d23..5e966293c6 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
@@ -48,15 +48,15 @@ void fullbright_shiny_lighting()
{
vec4 color = diffuseLookup(vary_texcoord0.xy);
color.rgb *= vertex_color.rgb;
-
+
// SL-9632 HUDs are affected by Atmosphere
if (no_atmo == 0)
{
- vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
- color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low
+ vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
+ color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low
- color.rgb = fullbrightShinyAtmosTransport(color.rgb);
- color.rgb = fullbrightScaleSoftClip(color.rgb);
+ color.rgb = fullbrightShinyAtmosTransport(color.rgb);
+ color.rgb = fullbrightScaleSoftClip(color.rgb);
}
/*
// NOTE: HUD objects will be full bright. Uncomment if you want "some" environment lighting effecting these HUD objects.
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
index a0699affbf..3b4d358cfa 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
@@ -1,30 +1,37 @@
-/**
+/**
* @file class1\windlight\atmosphericVarsF.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 getPositionEye()
-{
- return vec3(0,0,0);
-}
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
+
+vec3 getAmblitColor() { return vec3(0, 0, 0); }
+
+vec3 getAdditiveColor() { return vary_AdditiveColor; }
+
+vec3 getAtmosAttenuation() { return vec3(vary_AtmosAttenuation); }
+
+vec3 getSunlitColor() { return vec3(0, 0, 0); }
+
+vec3 getPositionEye() { return vec3(0, 0, 0); }
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
index bd1d150fc8..1fea2c3628 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
@@ -1,36 +1,56 @@
-/**
+/**
* @file class1\windlight\atmosphericVarsV.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$
*/
-
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
-vec3 getPositionEye()
+vec3 additive_color;
+vec3 atmos_attenuation;
+vec3 sunlit_color;
+vec3 amblit_color;
+vec3 position_eye;
+
+vec3 getSunlitColor() { return sunlit_color; }
+void setSunlitColor(vec3 v) { sunlit_color = v; }
+
+vec3 getAdditiveColor() { return additive_color; }
+void setAdditiveColor(vec3 v)
{
- return vec3(0,0,0);
+ additive_color = v;
+ vary_AdditiveColor = v;
}
-void setPositionEye(vec3 v)
+vec3 getAmblitColor() { return amblit_color; }
+void setAmblitColor(vec3 v) { amblit_color = v; }
+
+vec3 getAtmosAttenuation() { return atmos_attenuation; }
+void setAtmosAttenuation(vec3 v)
{
-
+ atmos_attenuation = v;
+ vary_AtmosAttenuation = v;
}
+
+vec3 getPositionEye() { return position_eye; }
+void setPositionEye(vec3 v) { position_eye = v; }
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl
index 5dc086ab1e..f83434b7ec 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl
@@ -1,33 +1,38 @@
-/**
+/**
* @file class1\windlight\atmosphericVarsWaterF.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$
*/
-
VARYING vec3 vary_PositionEye;
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
+
+vec3 getSunlitColor() { return vec3(0, 0, 0); }
+
+vec3 getAmblitColor() { return vec3(0, 0, 0); }
+
+vec3 getAdditiveColor() { return vary_AdditiveColor; }
-vec3 getPositionEye()
-{
- return vary_PositionEye;
-}
+vec3 getAtmosAttenuation() { return vary_AtmosAttenuation; }
+vec3 getPositionEye() { return vary_PositionEye; }
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl
index e59eca265a..65d1176777 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl
@@ -1,37 +1,51 @@
-/**
+/**
* @file class1\windlight\atmosphericVarsWaterV.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$
*/
-
-
+
VARYING vec3 vary_PositionEye;
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
-vec3 getPositionEye()
-{
- return vary_PositionEye;
-}
+vec3 atmos_attenuation;
+vec3 sunlit_color;
+vec3 amblit_color;
+
+vec3 getSunlitColor() { return sunlit_color; }
+void setSunlitColor(vec3 v) { sunlit_color = v; }
+
+vec3 getAmblitColor() { return amblit_color; }
+void setAmblitColor(vec3 v) { amblit_color = v; }
-void setPositionEye(vec3 v)
+vec3 getAdditiveColor() { return vary_AdditiveColor; }
+void setAdditiveColor(vec3 v) { vary_AdditiveColor = v; }
+
+vec3 getAtmosAttenuation() { return atmos_attenuation; }
+void setAtmosAttenuation(vec3 v)
{
- vary_PositionEye = v;
+ atmos_attenuation = v;
+ vary_AtmosAttenuation = v;
}
+
+vec3 getPositionEye() { return vary_PositionEye; }
+void setPositionEye(vec3 v) { vary_PositionEye = v; }
diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl
index b9ae7a0226..5a41dc644a 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl
@@ -51,7 +51,6 @@ void main()
// SL-9806 stars poke through
// c.a *= sun_fade;
- c.rgb = pow(c.rgb, vec3(0.7f));
c.rgb = fullbrightAtmosTransport(c.rgb);
c.rgb = fullbrightScaleSoftClip(c.rgb);
frag_color = c;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 5d7a28c359..1b7a1cc6ec 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -191,10 +191,6 @@ void main()
float da = dot(norm, lv);
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
- // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space.
- // We can't switch to linear here unless we do it everywhere*
- // *gbuffer IS sRGB, convert to linear since this shader outputs linear
- diff_tex.rgb = srgb_to_linear(diff_tex.rgb);
vec4 spec = texture2DRect(specularRect, frag.xy);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
index 1485c515a4..6841a8194f 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
@@ -73,7 +73,21 @@ uniform float ice_level;
vec3 rainbow(float d)
{
- d = clamp(d, -1.0, 0.0);
+ // d is the dot product of view and sun directions, so ranging -1.0..1.0
+ // 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec
+ // Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175.
+
+ // SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted.
+ // Rather than replace the texture, we mirror and translate the y tc to keep the colors within the
+ // interesting range, but in reversed order: i.e. d = (1 - d) - 1.575
+ d = clamp(-0.575 - d, 0.0, 1.0);
+
+ // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible.
+ // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate
+ // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857
+ float interior_coord = max(0.0, d - 0.25) * 4.2857;
+ d = clamp(d, 0.0, 0.25) + interior_coord;
+
float rad = (droplet_radius - 5.0f) / 1024.0f;
return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index f4db53e0b7..7700d16007 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -87,8 +87,9 @@ void main()
float light_gamma = 1.0 / 1.3;
da = pow(da, light_gamma);
- vec4 diffuse = texture2DRect(diffuseRect, tc);
- vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
+ vec4 diffuse = texture2DRect(diffuseRect, tc);
+ diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14025
+ vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 5ab0b5c5b4..774f537821 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -189,7 +189,7 @@ void main()
lv = normalize(lv);
float da = dot(norm, lv);
- vec3 diff_tex = srgb_to_linear(texture2DRect(diffuseRect, frag.xy).rgb);
+ vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
vec4 spec = texture2DRect(specularRect, frag.xy);
vec3 dlit = vec3(0, 0, 0);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
index d758f85d71..07733bda18 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
@@ -1,5 +1,5 @@
/**
- * @file class2\wl\atmosphericVars.glsl
+ * @file class2\wl\atmosphericVarsF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
index 75bf8730df..fa928d993e 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
@@ -26,9 +26,9 @@
/*[EXTRA_CODE_HERE]*/
#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_data[3];
+out vec4 frag_color;
#else
-#define frag_data gl_FragData
+#define frag_color gl_FragColor
#endif
/////////////////////////////////////////////////////////////////////////
@@ -126,8 +126,6 @@ void main()
color.rgb = scaleSoftClip(color.rgb);
/// Gamma correct for WL (soft clip effect).
- frag_data[0] = vec4(color.rgb, alpha1);
- frag_data[1] = vec4(0.0,0.0,0.0,0.0);
- frag_data[2] = vec4(0,0,0,1);
+ frag_color = vec4(color.rgb, alpha1);
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index 1f881eb44b..97ffa9feef 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class2\wl\cloudsV.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, 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$
*/
@@ -33,26 +33,26 @@ ATTRIBUTE vec2 texcoord0;
///////////////////////////////////////////////////////////////////////////////
// Output parameters
-VARYING vec4 vary_CloudColorSun;
-VARYING vec4 vary_CloudColorAmbient;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
VARYING float vary_CloudDensity;
-VARYING vec2 vary_texcoord0;
-VARYING vec2 vary_texcoord1;
-VARYING vec2 vary_texcoord2;
-VARYING vec2 vary_texcoord3;
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
VARYING float altitude_blend_factor;
// Inputs
uniform vec3 camPosLocal;
-uniform vec4 lightnorm;
-uniform vec4 sunlight_color;
-uniform vec4 moonlight_color;
-uniform int sun_up_factor;
-uniform vec4 ambient_color;
-uniform vec4 blue_horizon;
-uniform vec4 blue_density;
+uniform vec4 lightnorm;
+uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
+uniform vec4 ambient_color;
+uniform vec4 blue_horizon;
+uniform vec4 blue_density;
uniform float haze_horizon;
uniform float haze_density;
@@ -60,7 +60,7 @@ uniform float cloud_shadow;
uniform float density_multiplier;
uniform float max_y;
-uniform vec4 glow;
+uniform vec4 glow;
uniform float sun_moon_glow_factor;
uniform vec4 cloud_color;
@@ -75,8 +75,8 @@ uniform float cloud_scale;
// indra\newview\llsettingsvo.cpp
void main()
{
- // World / view / projection
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ // World / view / projection
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
// Texture coords
// SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
@@ -93,7 +93,7 @@ void main()
vary_texcoord2 = vary_texcoord0 * 16.;
vary_texcoord3 = vary_texcoord1 * 16.;
- // Get relative position
+ // Get relative position
vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);
// fade clouds beyond a certain point so the bottom of the sky dome doesn't look silly at high altitude
@@ -101,27 +101,27 @@ void main()
// Adj position vector to clamp altitude
if (rel_pos.y > 0.)
- {
+ {
rel_pos *= (max_y / rel_pos.y);
- }
+ }
if (rel_pos.y < 0.)
- {
+ {
rel_pos *= (-32000. / rel_pos.y);
- }
+ }
- // Can normalize then
+ // Can normalize then
vec3 rel_pos_norm = normalize(rel_pos);
float rel_pos_len = length(rel_pos);
- // Initialize temp variables
- vec4 sunlight = sunlight_color;
- vec4 light_atten;
+ // Initialize temp variables
+ vec4 sunlight = sunlight_color;
+ vec4 light_atten;
- // Sunlight attenuation effect (hue and brightness) due to atmosphere
- // this is used later for sunlight modulation at various altitudes
+ // Sunlight attenuation effect (hue and brightness) due to atmosphere
+ // this is used later for sunlight modulation at various altitudes
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
- // Calculate relative weights
+ // Calculate relative weights
vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density));
vec4 blue_weight = blue_density / combined_haze;
vec4 haze_weight = haze_density / combined_haze;
@@ -130,63 +130,64 @@ void main()
float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);
sunlight *= exp(-light_atten * off_axis);
- // Distance
+ // Distance
float density_dist = rel_pos_len * density_multiplier;
// Transparency (-> combined_haze)
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
- // compiler gets confused.
+ // compiler gets confused.
combined_haze = exp(-combined_haze * density_dist);
- // Compute haze glow
+ // Compute haze glow
float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);
// haze_glow is 0 at the sun and increases away from sun
haze_glow = max(haze_glow, .001);
- // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
+ // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
haze_glow *= glow.x;
- // Higher glow.x gives dimmer glow (because next step is 1 / "angle")
+ // Higher glow.x gives dimmer glow (because next step is 1 / "angle")
haze_glow = pow(haze_glow, glow.z);
- // glow.z should be negative, so we're doing a sort of (1 / "angle") function
+ // glow.z should be negative, so we're doing a sort of (1 / "angle") function
haze_glow *= sun_moon_glow_factor;
- // Add "minimum anti-solar illumination"
+ // Add "minimum anti-solar illumination"
// For sun, add to glow. For moon, remove glow entirely. SL-13768
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25);
- // Increase ambient when there are more clouds
- vec4 tmpAmbient = ambient_color;
- tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
+ // Increase ambient when there are more clouds
+ vec4 tmpAmbient = ambient_color;
+ tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
- // Dim sunlight by cloud shadow percentage
- sunlight *= (1. - cloud_shadow);
+ // Dim sunlight by cloud shadow percentage
+ sunlight *= (1. - cloud_shadow);
- // Haze color below cloud
+ // Haze color below cloud
vec4 additiveColorBelowCloud =
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
- // CLOUDS
+ // CLOUDS
+ sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP
off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);
sunlight *= exp(-light_atten * off_axis);
- // Cloud color out
+ // Cloud color out
vary_CloudColorSun = (sunlight * haze_glow) * cloud_color;
- vary_CloudColorAmbient = tmpAmbient * cloud_color;
-
- // Attenuate cloud color by atmosphere
+ vary_CloudColorAmbient = tmpAmbient * cloud_color;
+
+ // Attenuate cloud color by atmosphere
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
vary_CloudColorSun *= combined_haze;
vary_CloudColorAmbient *= combined_haze;
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze);
- // Make a nice cloud density based on the cloud_shadow value that was passed in.
- vary_CloudDensity = 2. * (cloud_shadow - 0.25);
+ // Make a nice cloud density based on the cloud_shadow value that was passed in.
+ vary_CloudDensity = 2. * (cloud_shadow - 0.25);
- // Combine these to minimize register use
- vary_CloudColorAmbient += oHazeColorBelowCloud;
+ // Combine these to minimize register use
+ vary_CloudColorAmbient += oHazeColorBelowCloud;
- // needs this to compile on mac
- // vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
+ // needs this to compile on mac
+ //vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
- // END CLOUDS
+ // END CLOUDS
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl
deleted file mode 100644
index 8bb3f07fc6..0000000000
--- a/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * @file lightInfo.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$
- */
-
-struct DirectionalLightInfo
-{
- vec4 pos;
- float depth;
- vec4 normal;
- vec3 normalizedLightDirection;
- vec3 normalizedToLight;
- float lightIntensity;
- vec3 lightDiffuseColor;
- float specExponent;
- float shadow;
-};
-
-struct SpotLightInfo
-{
- vec4 pos;
- float depth;
- vec4 normal;
- vec3 normalizedLightDirection;
- vec3 normalizedToLight;
- float lightIntensity;
- float attenuation;
- float distanceToLight;
- vec3 lightDiffuseColor;
- float innerHalfAngleCos;
- float outerHalfAngleCos;
- float spotExponent;
- float specExponent;
- float shadow;
-};
-
-struct PointLightInfo
-{
- vec4 pos;
- float depth;
- vec4 normal;
- vec3 normalizedToLight;
- float lightIntensity;
- float attenuation;
- float distanceToLight;
- vec3 lightDiffuseColor;
- float lightRadius;
- float specExponent;
- vec3 worldspaceLightDirection;
- float shadow;
-};
-
-float attenuate(float attenuationSelection, float distanceToLight)
-{
-// LLRENDER_REVIEW
-// sh/could eventually consume attenuation func defined in texture
- return (attenuationSelection == 0.0f) ? 1.0f : // none
- (attenuationSelection < 1.0f) ? (1.0f / distanceToLight) : // linear atten
- (attenuationSelection < 2.0f) ? (1.0f / (distanceToLight*distanceToLight)) // quadratic atten
- : (1.0f / (distanceToLight*distanceToLight*distanceToLight)); // cubic atten
-}
-
-
-vec3 lightDirectional(struct DirectionalLightInfo dli)
-{
- float lightIntensity = dli.lightIntensity;
- lightIntensity *= dot(dli.normal.xyz, dli.normalizedLightDirection);
- //lightIntensity *= directionalShadowSample(vec4(dli.pos.xyz, 1.0f), dli.depth, dli.directionalShadowMap, dli.directionalShadowMatrix);
- return lightIntensity * dli.lightDiffuseColor;
-}
-
-
-vec3 lightSpot(struct SpotLightInfo sli)
-{
- float penumbraRange = (sli.outerHalfAngleCos - sli.innerHalfAngleCos);
- float coneAngleCos = max(dot(sli.normalizedLightDirection, sli.normalizedToLight), 0.0);
- float coneAttenFactor = (coneAngleCos <= sli.outerHalfAngleCos) ? 1.0f : pow(smoothstep(1,0, sli.outerHalfAngleCos / penumbraRange), sli.spotExponent);
- float distanceAttenuation = attenuate(sli.attenuation, sli.distanceToLight);
- float lightIntensity = sli.lightIntensity;
- lightIntensity *= distanceAttenuation;
- lightIntensity *= max(dot(sli.normal.xyz, sli.normalizedLightDirection), 0.0);
- lightIntensity *= coneAttenFactor;
- lightIntensity *= sli.shadow;
- return lightIntensity * sli.lightDiffuseColor;
-}
-
-vec3 lightPoint(struct PointLightInfo pli)
-{
- float padRadius = pli.lightRadius * 0.1; // distance for which to perform smoothed dropoff past light radius
- float distanceAttenuation = attenuate(pli.attenuation, pli.distanceToLight);
- float lightIntensity = pli.lightIntensity;
- lightIntensity*= distanceAttenuation;
- lightIntensity *= clamp((padRadius - pli.distanceToLight + pli.lightRadius) / padRadius, 0.0, 1.0);
- lightIntensity *= pli.shadow;
- lightIntensity *= max(dot(pli.normal.xyz, pli.normalizedToLight), 0.0);
- return lightIntensity * pli.lightDiffuseColor;
-}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
index 6de01cb667..a0b082ed7c 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
@@ -56,8 +56,23 @@ vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir
vec3 ColorFromRadiance(vec3 radiance);
vec3 rainbow(float d)
{
- float rad = (droplet_radius - 5.0f) / 1024.0f;
- return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
+ // d is the dot product of view and sun directions, so ranging -1.0..1.0
+ // 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec
+ // Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175.
+
+ // SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted.
+ // Rather than replace the texture, we mirror and translate the y tc to keep the colors within the
+ // interesting range, but in reversed order: i.e. d = (1 - d) - 1.575
+ d = clamp(-0.575 - d, 0.0, 1.0);
+
+ // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible.
+ // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate
+ // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857
+ float interior_coord = max(0.0, d - 0.25) * 4.2857;
+ d = clamp(d, 0.0, 0.25) + interior_coord;
+
+ float rad = (droplet_radius - 5.0f) / 1024.0f;
+ return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
}
vec3 halo22(float d)