diff options
author | Graham Linden <graham@lindenlab.com> | 2019-06-10 09:15:35 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-06-10 09:15:35 -0700 |
commit | b79d0d2fdd047636598cbc9b088c3d4a10a84460 (patch) | |
tree | 6849c5cc4582c4720d121673121a418524a0cf77 /indra | |
parent | 49eae58bd0d1eceda18a3997454beb15a5e27cbd (diff) |
SL-10969, SL-11051
Make fullbright alpha mask with mask cutoff == 0 not generate shadows.
Adjust handling of ambient across forward and deferred again.
Diffstat (limited to 'indra')
10 files changed, 35 insertions, 33 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 1ed25d1dba..b4de492abc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -40,7 +40,6 @@ out vec4 frag_color; uniform float display_gamma; uniform vec4 gamma; uniform mat3 env_mat; -uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; uniform vec3 moon_dir; @@ -78,7 +77,7 @@ vec2 encode_normal (vec3 n); vec3 scaleSoftClipFrag(vec3 l); vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); -void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive); +void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive, bool use_ao); #ifdef HAS_SHADOW float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); @@ -217,7 +216,7 @@ void main() vec3 additive; vec3 atten; - calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten); + calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten, false); vec2 abnormal = encode_normal(norm.xyz); @@ -240,7 +239,7 @@ void main() vec3 sun_contrib = min(final_da, shadow) * sunlit; #if !defined(AMBIENT_KILL) - color.rgb = amblit * 0.5; + color.rgb = amblit * 2.0; color.rgb *= ambient; #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 1e7ca08aa1..1f0fa97297 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -41,7 +41,7 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); vec3 scaleSoftClipFrag(vec3 l); -void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); +void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); vec3 srgb_to_linear(vec3 cs); vec3 linear_to_srgb(vec3 cs); @@ -67,7 +67,6 @@ uniform vec3 camPosLocal; //uniform vec4 camPosWorld; uniform vec4 gamma; uniform mat3 env_mat; -uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; uniform vec3 moon_dir; @@ -226,14 +225,8 @@ void main() vec2 pos_screen = vary_texcoord0.xy; vec4 diffuse_tap = texture2D(diffuseMap, vary_texcoord0.xy); - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - vec4 diffuse_srgb = diffuse_tap; - vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_tap.a); -#else vec4 diffuse_linear = diffuse_tap; vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_tap.a); -#endif #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) if (diffuse_linear.a < minimum_alpha) @@ -313,7 +306,7 @@ void main() vec3 additive; vec3 atten; - calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten); + calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten, false); vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); @@ -333,7 +326,7 @@ void main() vec3 sun_contrib = min(final_da, shadow) * sunlit; #if !defined(AMBIENT_KILL) - color.rgb = amblit * 0.5; + color.rgb = amblit * 2.0; color.rgb *= ambient; #endif @@ -345,7 +338,7 @@ vec3 post_ambient = color.rgb; vec3 post_sunlight = color.rgb; - color.rgb *= diffuse_srgb.rgb; + color.rgb *= diffuse_linear.rgb; vec3 post_diffuse = color.rgb; diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl index 721e682029..80b096fd97 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl @@ -43,6 +43,11 @@ void main() { float alpha = diffuseLookup(vary_texcoord0.xy).a; + // mask cutoff 0 -> no shadow SL-11051 + if (minimum_alpha == 0) + { + discard; + } if (alpha < 0.05) // treat as totally transparent { diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 7f7faffe78..8c0f74d679 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -59,7 +59,7 @@ uniform vec2 screen_res; vec3 getNorm(vec2 pos_screen); vec4 getPositionWithDepth(vec2 pos_screen, float depth); -void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); +void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); float getAmbientClamp(); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); vec3 scaleSoftClipFrag(vec3 l); @@ -87,8 +87,8 @@ void main() float final_da = da; final_da = clamp(final_da, 0.0, 1.0); - vec4 diffuse_linear = texture2DRect(diffuseRect, tc); - vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a); + vec4 diffuse_srgb = texture2DRect(diffuseRect, tc); + vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec3 color = vec3(0); @@ -101,7 +101,7 @@ void main() vec3 additive; vec3 atten; - calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten); + calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten, false); float ambient = da; ambient *= 0.5; @@ -111,7 +111,7 @@ void main() vec3 sun_contrib = final_da * sunlit; #if !defined(AMBIENT_KILL) - color.rgb = amblit * 2.0; + color.rgb = amblit; color.rgb *= ambient; #endif @@ -123,7 +123,7 @@ vec3 post_ambient = color.rgb; vec3 post_sunlight = color.rgb; - color.rgb *= diffuse_linear.rgb; + color.rgb *= diffuse_srgb.rgb; vec3 post_diffuse = color.rgb; @@ -210,6 +210,7 @@ vec3 post_atmo = color.rgb; //color.rgb = vec3(final_da); //color.rgb = vec3(ambient); //color.rgb = vec3(scol); +//color.rgb = diffuse_linear.rgb; frag_color.rgb = color.rgb; frag_color.a = bloom; diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index fa20d63a4a..deda4d8b7e 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -47,7 +47,7 @@ float getAmbientClamp() return 1.0f; } -void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) { +void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao) { vec3 P = inPositionEye; @@ -116,9 +116,11 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o temp2.x += .25; temp2.x *= sun_moon_glow_factor; - + + vec4 amb_color = ambient_color; + //increase ambient when there are more clouds - vec4 tmpAmbient = ambient_color + (vec4(1.) - ambient_color) * cloud_shadow * 0.5; + vec4 tmpAmbient = amb_color + (vec4(1.) - amb_color) * 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 @@ -128,7 +130,10 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o * 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); + if (use_ao) + { + tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); + } //haze color additive = diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 92794ddaae..da85786317 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -59,7 +59,7 @@ uniform vec2 screen_res; vec3 getNorm(vec2 pos_screen); vec4 getPositionWithDepth(vec2 pos_screen, float depth); -void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); +void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); float getAmbientClamp(); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); vec3 scaleSoftClipFrag(vec3 l); @@ -109,7 +109,7 @@ void main() vec3 additive; vec3 atten; - calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten); + calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten, true); float ambient = da; ambient *= 0.5; diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl index d66983a951..baba79ca96 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl @@ -32,7 +32,7 @@ void setPositionEye(vec3 v); vec3 getAdditiveColor(); -void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); +void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); void calcAtmospherics(vec3 inPositionEye) { @@ -42,7 +42,7 @@ void calcAtmospherics(vec3 inPositionEye) { vec3 tmpamblit = vec3(1); vec3 tmpaddlit = vec3(1); vec3 tmpattenlit = vec3(1); - calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit); + calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit, false); setSunlitColor(tmpsunlit); setAmblitColor(tmpamblit); setAdditiveColor(tmpaddlit); diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 6400e5169e..82a899ad65 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -53,7 +53,6 @@ uniform vec4 glow; uniform float global_gamma; uniform mat3 env_mat; uniform vec4 shadow_clip; -uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; VARYING vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl index cba87a1db7..30ad493331 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl @@ -35,7 +35,7 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color) vec4 c = sumLights(pos, norm, color); #if !defined(AMBIENT_KILL) - c.rgb += atmosAmbient() * color.rgb * 2.0 * getAmbientClamp(); + c.rgb += atmosAmbient() * color.rgb * getAmbientClamp(); #endif return c; diff --git a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl index 27fdae962e..7b4269ca6f 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl @@ -32,7 +32,7 @@ void setPositionEye(vec3 v); vec3 getAdditiveColor(); -void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); +void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); void calcAtmospherics(vec3 inPositionEye) { @@ -42,7 +42,7 @@ void calcAtmospherics(vec3 inPositionEye) { vec3 tmpamblit = vec3(1); vec3 tmpaddlit = vec3(1); vec3 tmpattenlit = vec3(1); - calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit); + calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit, true); setSunlitColor(tmpsunlit); setAmblitColor(tmpamblit); setAdditiveColor(tmpaddlit); |