diff options
author | Rider Linden <rider@lindenlab.com> | 2019-04-05 17:05:54 +0000 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2019-04-05 17:05:54 +0000 |
commit | f6283ad141c8a6c0de18ee78023b002f1f8ec14d (patch) | |
tree | d295d546a33060e9eaa3e153c13469346dfc79dc /indra | |
parent | d7789999cb6bab7b4e28236d99c4c2a8006497ff (diff) | |
parent | 09bb0336f15027e907fbd28130b4ffda28a830cd (diff) |
Merged in graham_linden/viewer-eep-fixes (pull request #338)
SL-10854
Diffstat (limited to 'indra')
4 files changed, 20 insertions, 15 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index dac93cee3a..1bc576a4ec 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -194,8 +194,10 @@ void main() vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir; float da = dot(norm.xyz, light_dir.xyz); - da = clamp(da, 0.0, 1.0); - da = pow(da, 1.0 / 1.3); + + float final_da = da; + final_da = clamp(final_da, 0.0f, 1.0f); + final_da = pow(final_da, 1.0/1.3); vec4 color = vec4(0,0,0,0); @@ -205,9 +207,10 @@ void main() float ambient = abs(da); ambient *= 0.5; ambient *= ambient; + ambient = max(0.9, ambient); // keeps shadows dark ambient = 1.0 - ambient; - vec3 sun_contrib = min(da, shadow) * sunlit; + vec3 sun_contrib = min(final_da, shadow) * sunlit; color.rgb *= ambient; color.rgb += sun_contrib; diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index c43b5b22bf..4e24e61018 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -296,16 +296,18 @@ void main() vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; float da = dot(norm.xyz, light_dir.xyz); - da = clamp(da, 0.0, 1.0); - da = pow(da, 1.0 / 1.3); + + float final_da = da; + final_da = clamp(final_da, 0.0, 1.0); + final_da = pow(final_da, 1.0 / 1.3); float ambient = abs(da); ambient *= 0.5; ambient *= ambient; + ambient = max(0.9, ambient); ambient = 1.0 - ambient; - float final_da = min(da, shadow); - vec3 sun_contrib = final_da * sunlit; + vec3 sun_contrib = min(final_da, shadow) * sunlit; col.rgb = amblit; col.rgb *= ambient; diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl index 6ff49c7dac..642aff6c41 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl @@ -51,15 +51,12 @@ float pcfShadow(sampler2DShadow shadowMap, vec3 norm, vec4 stc, float bias_mul, stc.xyz /= stc.w; stc.z += shadow_bias * bias_mul * 2.0; stc.x = floor(stc.x*shadow_res.x + fract(stc.y*shadow_res.y))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here - float cs = shadow2D(shadowMap, stc.xyz).x; float shadow = cs * 4.0; - shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x; shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x; shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x; shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x; - return shadow * 0.125; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 7f1d518dd6..92888e0fd2 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -94,18 +94,20 @@ void main() vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; + float light_gamma = 1.0/1.3; float scol = 1.0; vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; float da = dot(normalize(norm.xyz), light_dir.xyz); - da = clamp(da, 0.0, 1.0); - - float light_gamma = 1.0/1.3; - da = pow(da, light_gamma); vec4 diffuse = texture2DRect(diffuseRect, tc); scol = max(scol_ambocc.r, diffuse.a); + //scol = pow(scol, light_gamma); + + float final_da = da; + final_da = clamp(final_da, 0.0, 1.0); + final_da = pow(final_da, light_gamma); vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec3 col; @@ -123,9 +125,10 @@ void main() float ambient = abs(da); ambient *= 0.5; ambient *= ambient; + ambient = max(0.9, ambient); ambient = 1.0 - ambient; - vec3 sun_contrib = min(da,scol) * sunlit; + vec3 sun_contrib = min(scol, final_da) * sunlit; col.rgb = amblit; col.rgb *= ambient; |