summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/windlight
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-09-14 21:52:52 +0100
committerGraham Linden <graham@lindenlab.com>2018-09-14 21:52:52 +0100
commit1df7760d315430766bba44d4d4c64480b4a6138f (patch)
treef84ded9bc43e43b2c2fc985ed7a95aa4f0add69c /indra/newview/app_settings/shaders/class2/windlight
parenta167f8857fd242e007a6bcbcee80a54a953f29f3 (diff)
SL-9632 add uniform and code to supress atmospherics in all shaders that could be used by HUDs
Make sky and cloud shaders use common scaleSoftClip implementation in gammaF.glsl
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/windlight')
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/transportF.glsl22
5 files changed, 37 insertions, 24 deletions
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
index fee1a7f311..4ec5691a85 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
@@ -43,9 +43,14 @@ uniform float max_y;
uniform vec4 glow;
uniform float scene_light_strength;
uniform mat3 ssao_effect_mat;
+uniform int no_atmo;
vec3 scaleFragSoftClip(vec3 light)
{
+ if (no_atmo == 1)
+ {
+ return light;
+ }
//soft clip effect:
light = 1. - clamp(light, vec3(0.), vec3(1.));
light = 1. - pow(light, gamma.xxx);
@@ -54,14 +59,17 @@ vec3 scaleFragSoftClip(vec3 light)
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
{
- light *= atten.r;
- light += additive;
+ if (no_atmo == 0)
+ {
+ light *= atten.r;
+ light += additive;
+ }
return (2.0 * light);
}
vec3 atmosLighting(vec3 light)
{
- return atmosFragLighting(light, getAdditiveColor(), getAtmosAttenuation());
+ return (no_atmo == 1) ? light : atmosFragLighting(light, getAdditiveColor(), getAtmosAttenuation());
}
void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) {
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
index e0c7e18a6f..24fdb45749 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
@@ -49,13 +49,7 @@ uniform vec4 cloud_pos_density2;
uniform vec4 gamma;
/// Soft clips the light with a gamma correction
-vec3 scaleSoftClip(vec3 light) {
- //soft clip effect:
- light = 1. - clamp(light, vec3(0.), vec3(1.));
- light = 1. - pow(light, gamma.xxx);
-
- return light;
-}
+vec3 scaleSoftClip(vec3 light);
vec4 cloudNoise(vec2 uv)
{
diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
index 2db633cd01..f2764b72c3 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
@@ -26,11 +26,16 @@
uniform vec4 gamma;
+uniform int no_atmo;
vec3 getAtmosAttenuation();
/// Soft clips the light with a gamma correction
vec3 scaleSoftClip(vec3 light) {
+ if (no_atmo == 1)
+ {
+ return light;
+ }
//soft clip effect:
light = 1. - clamp(light, vec3(0.), vec3(1.));
light = 1. - pow(light, gamma.xxx);
@@ -40,10 +45,10 @@ vec3 scaleSoftClip(vec3 light) {
vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 atten)
{
- return mix(scaleSoftClip(light.rgb), light.rgb, atten);
+ return (no_atmo == 1) ? light : mix(scaleSoftClip(light.rgb), light.rgb, atten);
}
vec3 fullbrightScaleSoftClip(vec3 light) {
- return fullbrightScaleSoftClipFrag(light.rgb, getAtmosAttenuation());
+ return (no_atmo == 1) ? light : fullbrightScaleSoftClipFrag(light.rgb, getAtmosAttenuation());
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
index 25fd0584f8..28d185b9af 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
@@ -38,13 +38,7 @@ VARYING vec4 vary_HazeColor;
uniform vec4 gamma;
/// Soft clips the light with a gamma correction
-vec3 scaleSoftClip(vec3 light) {
- //soft clip effect:
- light = 1. - clamp(light, vec3(0.), vec3(1.));
- light = 1. - pow(light, gamma.xxx);
-
- return light;
-}
+vec3 scaleSoftClip(vec3 light);
void main()
{
diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
index 82e1d7fe35..9627642b9d 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
@@ -32,31 +32,43 @@ vec3 getAtmosAttenuation();
uniform sampler2D cloudMap;
uniform vec4 cloud_pos_density1;
+uniform int no_atmo;
vec3 atmosFragTransport(vec3 light, vec3 atten, vec3 additive) {
- light *= atten.r;
- light += additive * 2.0;
+ if (no_atmo == 0)
+ {
+ light *= atten.r;
+ light += additive * 2.0;
+ }
return light;
}
vec3 fullbrightFragAtmosTransport(vec3 light, vec3 atten, vec3 additive) {
+ if (no_atmo == 1)
+ {
+ return light;
+ }
float brightness = dot(light.rgb, vec3(0.33333));
return mix(atmosFragTransport(light.rgb, atten, additive), light.rgb + additive.rgb, brightness * brightness);
}
vec3 fullbrightFragShinyAtmosTransport(vec3 light, vec3 atten, vec3 additive) {
+ if (no_atmo == 1)
+ {
+ return light;
+ }
float brightness = dot(light.rgb, vec3(0.33333));
return mix(atmosFragTransport(light.rgb, atten, additive), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness);
}
vec3 atmosTransport(vec3 light) {
- return atmosFragTransport(light, getAtmosAttenuation(), getAdditiveColor());
+ return (no_atmo == 1) ? light : atmosFragTransport(light, getAtmosAttenuation(), getAdditiveColor());
}
vec3 fullbrightAtmosTransport(vec3 light) {
- return fullbrightFragAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor());
+ return (no_atmo == 1) ? light : fullbrightFragAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor());
}
vec3 fullbrightShinyAtmosTransport(vec3 light) {
- return fullbrightFragShinyAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor());
+ return (no_atmo == 1) ? light : fullbrightFragShinyAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor());
}