summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1
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/class1
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/class1')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl2
8 files changed, 39 insertions, 12 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 3ec2ea12da..f79fc012d1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -88,7 +88,7 @@ vec3 linear_to_srgb(vec3 cl);
vec2 encode_normal (vec3 n);
vec3 decode_normal (vec2 enc);
-vec3 scaleSoftClipFrag(vec3 l);
+vec3 scaleSoftClip(vec3 l);
vec3 atmosFragAmbient(vec3 light, vec3 sunlit);
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
vec3 atmosFragAffectDirectionalLight(float light, vec3 sunlit);
@@ -305,7 +305,7 @@ void main()
//color.rgb = mix(diff.rgb, color.rgb, final_alpha);
color.rgb = atmosFragLighting(color.rgb, additive, atten);
- color.rgb = scaleSoftClipFrag(color.rgb);
+ color.rgb = scaleSoftClip(color.rgb);
vec4 light = vec4(0,0,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 5627275df6..18259ed9ed 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -70,8 +70,12 @@ vec3 linear_to_srgb(vec3 cl);
vec3 decode_normal (vec2 enc);
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
+vec3 fullbrightAtmosTransportFrag(vec3 l, vec3 additive, vec3 atten);
void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
+vec3 scaleSoftClip(vec3 l);
+vec3 fullbrightScaleSoftClip(vec3 l);
+
vec4 getPosition_d(vec2 pos_screen, float depth)
{
vec2 sc = pos_screen.xy*2.0;
@@ -129,8 +133,8 @@ void main()
ambient = (1.0 - ambient);
col = amblit;
- col += (final_da * sunlit);
col *= ambient;
+ col += (final_da * sunlit);
col *= diffuse.rgb;
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
@@ -141,7 +145,6 @@ void main()
//
float sa = dot(refnormpersp, sun_dir.xyz);
-
vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together
@@ -166,17 +169,19 @@ void main()
if (norm.w < 0.5)
{
- col = atmosFragLighting(col, additive, atten);
+ col = mix(atmosFragLighting(col, additive, atten), fullbrightAtmosTransportFrag(col, additive, atten), diffuse.a);
+ col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a);
}
#ifdef WATER_FOG
- vec4 fogged = applyWaterFogView(pos,vec4(col, bloom));
+ vec4 fogged = applyWaterFogView(pos.xyz,vec4(col, bloom));
col = fogged.rgb;
bloom = fogged.a;
#endif
col = srgb_to_linear(col);
+ //col = vec3(1,0,1);
//col.g = envIntensity;
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
index 352cea7aaa..1fe98a9575 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
@@ -31,8 +31,8 @@ ATTRIBUTE vec3 position;
void calcAtmospherics(vec3 inPositionEye);
-uniform vec2 d1;
-uniform vec2 d2;
+uniform vec2 waveDir1;
+uniform vec2 waveDir2;
uniform float time;
uniform vec3 eyeVec;
uniform float waterHeight;
@@ -86,10 +86,10 @@ void main()
//pass wave parameters to pixel shader
- vec2 bigWave = (v.xy) * vec2(0.04,0.04) + d1 * time * 0.055;
+ vec2 bigWave = (v.xy) * vec2(0.04,0.04) + waveDir1 * time * 0.055;
//get two normal map (detail map) texture coordinates
- littleWave.xy = (v.xy) * vec2(0.45, 0.9) + d2 * time * 0.13;
- littleWave.zw = (v.xy) * vec2(0.1, 0.2) + d1 * time * 0.1;
+ littleWave.xy = (v.xy) * vec2(0.45, 0.9) + waveDir2 * time * 0.13;
+ littleWave.zw = (v.xy) * vec2(0.1, 0.2) + waveDir1 * time * 0.1;
view.w = bigWave.y;
refCoord.w = bigWave.x;
diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
index 10958025ac..7059ff31ae 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
@@ -29,6 +29,7 @@ float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, 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_diffuse[8];
@@ -43,6 +44,7 @@ vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor
vec4 specularSum = vec4(0.0);
col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0);
+ col.rgb = scaleDownLight(col.rgb);
col.rgb += atmosAmbient(baseCol.rgb);
col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor()*baseCol.a, 1.0));
diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
index 569b629ef8..41288c21c1 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
@@ -30,6 +30,7 @@ float calcDirectionalLight(vec3 n, vec3 l);
vec3 atmosAmbient(vec3 light);
vec3 atmosAffectDirectionalLight(float lightIntensity);
+vec3 scaleDownLight(vec3 light);
vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
{
@@ -37,6 +38,7 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
col.a = color.a;
col.rgb = light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
+ col.rgb = scaleDownLight(col.rgb);
col.rgb += atmosAmbient(baseLight.rgb);
col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz));
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl
index 9e5893d32a..c16e3d50a2 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl
@@ -41,3 +41,9 @@ vec3 atmosGetDiffuseSunlightColor()
return sunlight_color.rgb;
}
+vec3 scaleDownLight(vec3 light)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ return light;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
index 01f19087ff..89b6a52909 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
@@ -41,3 +41,15 @@ vec3 atmosGetDiffuseSunlightColor()
return sunlight_color.rgb;
}
+vec3 scaleDownLight(vec3 light)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ return light;
+}
+
+vec3 scaleUpLight(vec3 light)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ return light;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
index 768d93f005..667301443a 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
@@ -39,7 +39,7 @@ vec3 scaleSoftClip(vec3 light)
return light;
}
-vec3 fullbrightScaleSoftClipFrag(vec3 light)
+vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 additive, vec3 atten)
{
// For compatibility with lower cards. Do nothing
return light;