diff options
author | Graham Linden <graham@lindenlab.com> | 2018-11-06 16:38:06 +0000 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-11-06 16:38:06 +0000 |
commit | 8c1aefc17c710b55ed7a72bd9de14cbed58ccd31 (patch) | |
tree | fe13d4e2fca64318b8019906aa7525195c5ce159 /indra/newview/app_settings/shaders/class1 | |
parent | e0a1b46e6129a0e6ca62efe18882889db96c572f (diff) |
Remove scaleDownLight funcs and eliminate unused copy-pasted funcs in lighting shaders.
Also fix terrain response to atmospherics shaders (was failing to apply ambient on low end even when atmospherics was on).
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
11 files changed, 8 insertions, 53 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 1cfc19267c..3ec2ea12da 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -94,13 +94,6 @@ vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); vec3 atmosFragAffectDirectionalLight(float light, vec3 sunlit); void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive); -vec3 calcDirectionalLight(vec3 n, vec3 l) -{ - float a = max(dot(n,l),0.0); - a = pow(a, 1.0/1.3); - return vec3(a,a,a); -} - vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) { //get light vector diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl index f2d2300766..e68b082d43 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl @@ -34,7 +34,6 @@ mat4 getSkinnedTransform(); void calcAtmospherics(vec3 inPositionEye); float calcDirectionalLight(vec3 n, vec3 l); -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); vec3 atmosAmbient(vec3 light); vec3 atmosAffectDirectionalLight(float lightIntensity); @@ -57,12 +56,6 @@ uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; -float calcDirectionalLight(vec3 n, vec3 l) -{ - float a = max(dot(n,l),0.0); - return a; -} - float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) { //get light vector diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index c001ff9ac8..c1c17532b8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -110,13 +110,6 @@ uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; -vec3 calcDirectionalLight(vec3 n, vec3 l) -{ - float a = max(dot(n,l),0.0); - return vec3(a,a,a); -} - - vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare) { //get light vector diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl index 46bde7f308..668a710c04 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl @@ -59,10 +59,8 @@ void main() vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); /// Add WL Components - //outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); + outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); - outColor.rgb = atmosLighting(outColor.rgb); - frag_color = vec4(scaleSoftClip(outColor.rgb), 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl index 5ffe464172..4d6f0c67a5 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -71,7 +71,7 @@ void main() /// Potentially better without it for water. pos /= pos.w; - vec4 color = calcLighting(pos.xyz, norm, vec4(0), vec4(1)); + vec4 color = calcLighting(pos.xyz, norm, vec4(1), vec4(0)); vertex_color = color; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl index 85cddc647d..20e44d74d5 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl @@ -23,14 +23,6 @@ * $/LicenseInfo$ */ - - -float calcDirectionalLight(vec3 n, vec3 l) -{ - float a = max(dot(n,l),0.0); - return a; -} - float calcDirectionalSpecular(vec3 view, vec3 n, vec3 l) { return pow(max(dot(reflect(view, n),l), 0.0),8.0); diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl index 7059ff31ae..10958025ac 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl @@ -29,7 +29,6 @@ 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]; @@ -44,7 +43,6 @@ 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 41288c21c1..569b629ef8 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl @@ -30,7 +30,6 @@ 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) { @@ -38,7 +37,6 @@ 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/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl index bf0a9048f0..c1cc3679a7 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl @@ -25,13 +25,14 @@ vec3 atmosFragAmbient(vec3 light, vec3 sunlit) { - return light; + /* stub function for fallback compatibility on class1 hardware */ + return light; } vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { - /* stub function for fallback compatibility on class1 hardware */ - return light; + /* stub function for fallback compatibility on class1 hardware */ + return light; } vec3 atmosFragAffectDirectionalLight(float light, vec3 sunlit) @@ -41,7 +42,8 @@ vec3 atmosFragAffectDirectionalLight(float light, vec3 sunlit) vec3 atmosLighting(vec3 light) { - return atmosFragLighting(light, vec3(0), vec3(1.0)); + /* stub function for fallback compatibility on class1 hardware */ + return light; } void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive) diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl index c16e3d50a2..9e5893d32a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl @@ -41,9 +41,3 @@ 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 9f68ca3dfa..01f19087ff 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl @@ -41,9 +41,3 @@ vec3 atmosGetDiffuseSunlightColor() return sunlight_color.rgb; } -vec3 scaleDownLight(vec3 light) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - |