summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-11-12 15:54:53 -0800
committerGraham Linden <graham@lindenlab.com>2018-11-12 15:54:53 -0800
commita49e2b604e6b505e083e24b10e39053196d917c1 (patch)
tree931c403bcc66f9831b595b1aeb54534e5a5eff4a /indra/newview/app_settings/shaders/class2
parentbdf4442e216273bb32eeb607857efdad2336ee81 (diff)
SL-10044 SL-10045
Fix class 1 and 2 transport/gamma funcs and made usage consistent across all shaders. Fix class1\environment\waterV reverting to old d1/d2 names for wave directions.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/transportF.glsl4
8 files changed, 37 insertions, 38 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index c92dbda185..308a85d2d9 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -49,6 +49,7 @@ uniform vec4 morphFactor;
uniform vec3 camPosLocal;
//uniform vec4 camPosWorld;
uniform vec4 gamma;
+uniform vec4 lightnorm;
uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
@@ -83,32 +84,9 @@ vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
vec3 fullbrightScaleSoftClipFrag(vec3 l);
vec3 scaleSoftClipFrag(vec3 l);
-vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
-{
- if (no_atmo == 1)
- {
- return light;
- }
- return (light + additive) * atten.r * 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 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten);
+vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten);
+vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten);
vec4 getPosition_d(vec2 pos_screen, float depth)
{
@@ -175,7 +153,7 @@ void main()
ambient *= ambient;
ambient = (1.0-ambient);
- col.rgb = ambient * amblit;
+ col.rgb = ambient * ((col * 0.5) + amblit);
col += sunlit * max(min(da, scol), 0.0);
diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl
index eef259349f..3acf9fe883 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl
@@ -31,6 +31,7 @@ vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3
vec3 atmosAmbient(vec3 light);
vec3 atmosAffectDirectionalLight(float lightIntensity);
vec3 atmosGetDiffuseSunlightColor();
+vec3 scaleDownLight(vec3 light);
uniform vec4 light_position[8];
uniform vec3 light_attenuation[8];
@@ -49,6 +50,7 @@ vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor
col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0);
col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[2].xyz, light_attenuation[2].x, light_attenuation[2].y, light_diffuse[2].rgb);
col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[3].xyz, light_attenuation[3].x, light_attenuation[3].y, light_diffuse[3].rgb);
+ col.rgb = scaleDownLight(col.rgb);
// Add windlight lights
col.rgb += atmosAmbient(baseCol.rgb);
diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
index b42506dd40..c9987ef3b9 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
@@ -28,6 +28,7 @@ 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);
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
@@ -44,6 +45,8 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
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 = scaleDownLight(col.rgb);
+
// Add windlight lights
col.rgb += atmosAmbient(baseLight.rgb);
col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz));
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
index 229f8073b0..9653e0809e 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
@@ -52,13 +52,13 @@ vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
return light;
}
light *= atten.r;
- light += additive;
+ light += additive * 2.0;
return light;
}
vec3 atmosLighting(vec3 light)
{
- return (no_atmo == 1) ? light : atmosFragLighting(light, getAdditiveColor(), getAtmosAttenuation());
+ return 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/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl
index 8648c38501..63c683c99e 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl
@@ -37,3 +37,8 @@ vec3 atmosFragAffectDirectionalLight(float lightIntensity, vec3 sunlit)
return sunlit * lightIntensity;
}
+vec3 scaleDownLightFrag(vec3 light)
+{
+ return (light / scene_light_strength );
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl
index a83aa95f95..62a034ce05 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl
@@ -49,3 +49,13 @@ vec3 atmosGetDiffuseSunlightColor()
return getSunlitColor();
}
+vec3 scaleDownLight(vec3 light)
+{
+ return (light / scene_light_strength );
+}
+
+vec3 scaleUpLight(vec3 light)
+{
+ return (light * scene_light_strength);
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
index 187876acf7..6401845af2 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
@@ -36,10 +36,10 @@ vec3 scaleSoftClipFrag(vec3 light)
{
return light;
}
- //soft clip effect:
- light = 1. - clamp(light, vec3(0.), vec3(1.));
- light = 1. - pow(light, gamma.xxx);
- return light;
+ //soft clip effect:
+ light = 1. - clamp(light, vec3(0.), vec3(1.));
+ light = 1. - pow(light, gamma.xxx);
+ return light;
}
vec3 scaleSoftClip(vec3 light)
@@ -47,13 +47,12 @@ vec3 scaleSoftClip(vec3 light)
return scaleSoftClipFrag(light);
}
-vec3 fullbrightScaleSoftClipFrag(vec3 light)
-{
- return scaleSoftClipFrag(light.rgb);
+vec3 fullbrightScaleSoftClipFrag(vec3 light) {
+ return mix(scaleSoftClip(light.rgb), light.rgb, getAtmosAttenuation());
}
vec3 fullbrightScaleSoftClip(vec3 light)
{
- return fullbrightScaleSoftClipFrag(light.rgb);
+ return fullbrightScaleSoftClipFrag(light);
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
index 75d1bb0cd5..359fea3073 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
@@ -38,7 +38,9 @@ vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
{
return light;
}
- return (light + additive) * atten * 2.0;
+ light *= atten.r;
+ light += additive * 2.0;
+ return light;
}
vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten)