summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2019-04-22 21:36:34 +0000
committerRider Linden <rider@lindenlab.com>2019-04-22 21:36:34 +0000
commitafaa30b2568cdc9cabf85c941cf9d111a129c16a (patch)
tree7b0f0838ac8da4e15e1f499eaecd97fce5776805 /indra/newview/app_settings/shaders/class3
parentce9cf1027f733560e29f77c4a883bd9b5338f9d8 (diff)
parent9723bd8be2b710fa089f3404056c01f4dc55e6ac (diff)
Merged in graham_linden/viewer-eep-rc-fixes (pull request #361)
SL-10996, SL-10997, SL-10970, SL-10967, SL-10856
Diffstat (limited to 'indra/newview/app_settings/shaders/class3')
-rw-r--r--indra/newview/app_settings/shaders/class3/lighting/lightV.glsl37
-rw-r--r--indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl49
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl86
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/transportF.glsl26
8 files changed, 67 insertions, 139 deletions
diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
new file mode 100644
index 0000000000..b19f4e96ca
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
@@ -0,0 +1,37 @@
+/**
+ * @file class3\lighting\lightV.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$
+ */
+
+
+
+// All lights, no specular highlights
+
+vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight);
+vec3 atmosAmbient(vec3 c);
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
+{
+ vec4 l = sumLights(pos, norm, color, baseLight);
+ return l;
+}
+
diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl
index ce5855646c..6d4192ab13 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl
@@ -1,5 +1,5 @@
/**
- * @file sumLightsV.glsl
+ * @file class3\lighting\sumLightsSpecularV.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
index c410caa967..097889039d 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
@@ -1,5 +1,5 @@
/**
- * @file sumLightsV.glsl
+ * @file class3\lighing\sumLightsV.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -30,7 +30,6 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
vec3 atmosAmbient(vec3 light);
vec3 atmosAffectDirectionalLight(float lightIntensity);
vec3 scaleDownLight(vec3 light);
-vec3 scaleUpLight(vec3 light);
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
@@ -39,30 +38,26 @@ uniform vec3 light_diffuse[8];
vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
{
- vec4 col = vec4(0.0, 0.0, 0.0, color.a);
-
- // Collect normal lights (need to be divided by two, as we later multiply by 2)
-
- // Collect normal lights
- col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
- col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
- col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].z);
- col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].z);
- col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].z);
- col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].z);
- col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_position[1].xyz);
-
-
- // Add windlight lights
- float l = calcDirectionalLight(norm, light_position[0].xyz);
-
- // using light_diffuse[0] instead of WL func as it is set to the same value for these shaders anyway
- // when lights are sync'd
- col.rgb += l * light_diffuse[0].rgb;
- col.rgb = scaleDownLight(col.rgb);
-
- col.rgb += atmosAmbient(baseLight.rgb);
- col.rgb = min(col.rgb*color.rgb, 1.0);
- return col;
+ vec4 col = vec4(0.0, 0.0, 0.0, color.a);
+
+ // Collect normal lights (need to be divided by two, as we later multiply by 2)
+
+ // Collect normal lights
+ col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
+ col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
+ col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].z);
+ col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].z);
+ col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].z);
+ col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].z);
+ col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_direction[1].xyz);
+ col.rgb = scaleDownLight(col.grb);
+
+ // Add windlight lights
+ col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_direction[0].xyz));
+ col.rgb += atmosAmbient(baseLight.rgb);
+
+ col.rgb = min(col.rgb*color.rgb, 1.0);
+
+ return col;
}
diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl
index fed3edf7de..c6ea3ec9d4 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl
@@ -1,5 +1,5 @@
/**
- * @file advancedAtmoF.glsl
+ * @file class3\wl\advancedAtmoF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl
index 52a7595379..65bb00b1f6 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl
@@ -1,5 +1,5 @@
/**
- * @file advancedAtmoV.glsl
+ * @file class3\wl\advancedAtmoV.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
diff --git a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl
index 852c2478bc..c0a0d4782d 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl
@@ -1,5 +1,5 @@
/**
- * @file atmosphericsF.glsl
+ * @file class3\wl\atmosphericsF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -37,8 +37,6 @@ uniform vec4 blue_density;
uniform float haze_horizon;
uniform float haze_density;
uniform float cloud_shadow;
-uniform float density_multiplier;
-uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
uniform float scene_light_strength;
@@ -58,85 +56,3 @@ vec3 atmosLighting(vec3 light)
return atmosFragLighting(light, getAdditiveColor(), getAtmosAttenuation());
}
-void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) {
-
- vec3 P = inPositionEye;
-
- vec3 tmpLightnorm = lightnorm.xyz;
-
- vec3 Pn = normalize(P);
- float Plen = length(P);
-
- vec4 temp1 = vec4(0);
- vec3 temp2 = vec3(0);
- vec4 blue_weight;
- vec4 haze_weight;
- vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
- vec4 light_atten;
-
- //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);
- //I had thought blue_density and haze_density should have equal weighting,
- //but attenuation due to haze_density tends to seem too strong
-
- temp1 = blue_density + vec4(haze_density);
- blue_weight = blue_density / temp1;
- haze_weight = vec4(haze_density) / temp1;
-
- //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
- temp2.y = max(0.0, tmpLightnorm.y);
- temp2.y = 1. / temp2.y;
- sunlight *= exp( - light_atten * temp2.y);
-
- // main atmospheric scattering line integral
- temp2.z = Plen * density_multiplier;
-
- // Transparency (-> temp1)
- // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati
- // compiler gets confused.
- temp1 = exp(-temp1 * temp2.z * distance_multiplier);
-
- //final atmosphere attenuation factor
- atten = temp1.rgb;
-
- //compute haze glow
- //(can use temp2.x as temp because we haven't used it yet)
- temp2.x = dot(Pn, tmpLightnorm.xyz);
- temp2.x = 1. - temp2.x;
- //temp2.x is 0 at the sun and increases away from sun
- temp2.x = max(temp2.x, .03); //was glow.y
- //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
- temp2.x *= glow.x;
- //higher glow.x gives dimmer glow (because next step is 1 / "angle")
- temp2.x = pow(temp2.x, glow.z);
- //glow.z should be negative, so we're doing a sort of (1 / "angle") function
-
- //add "minimum anti-solar illumination"
- temp2.x += .25;
-
- //increase ambient when there are more clouds
- vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
-
- /* decrease value and saturation (that in HSV, not HSL) for occluded areas
- * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
- * // The following line of code performs the equivalent of:
- * float ambAlpha = tmpAmbient.a;
- * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis
- * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue);
- * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha);
- */
- tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
-
- //haze color
- additive =
- vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
- + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
- + tmpAmbient));
-
- //brightness of surface both sunlight and ambient
- sunlit = vec3(sunlight * .5);
- amblit = vec3(tmpAmbient * .25);
- additive *= vec3(1.0 - temp1);
-}
-
diff --git a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl
index b8c0547102..27fdae962e 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl
@@ -1,5 +1,5 @@
/**
- * @file atmosphericsV.glsl
+ * @file class3\wl\atmosphericsV.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl
index 90ab5d2793..e7e56087ab 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl
@@ -1,5 +1,5 @@
/**
- * @file transportF.glsl
+ * @file class3\wl\transportF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -41,26 +41,6 @@ vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
return (light + additive) * atten * 2.0;
}
-vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
-{
- if (no_atmo == 1)
- {
- return light;
- }
- float brightness = dot(light.rgb, vec3(0.33333));
- return mix(atmosTransportFrag(light.rgb, additive,atten), light.rgb + additive.rgb, brightness * brightness);
-}
-
-vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
-{
- if (no_atmo == 1)
- {
- return light;
- }
- float brightness = dot(light.rgb, vec3(0.33333));
- return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness);
-}
-
vec3 atmosTransport(vec3 light)
{
return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation());
@@ -68,10 +48,10 @@ vec3 atmosTransport(vec3 light)
vec3 fullbrightAtmosTransport(vec3 light)
{
- return fullbrightAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation());
+ return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation());
}
vec3 fullbrightShinyAtmosTransport(vec3 light)
{
- return fullbrightShinyAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation());
+ return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation());
}