summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-02-22 14:50:03 -0800
committerGraham Linden <graham@lindenlab.com>2019-02-22 14:50:03 -0800
commit4aad62006259c20bcdda1495138f7313b8f35e8d (patch)
treed6a011a2030535cb30c34e0e37f2b552d984ea90 /indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
parent9a66e4a9dec4ae6abbd9048c7cacd3480b513cbc (diff)
SL-10415, SL-10612, SL-10569
Fix shadow sampling min with caster dp and offset tweaks. Fix moon direction not being transformed as the sun dir is. Fix colorspace issue causing some objects to render grayish instead of blackish.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl13
1 files changed, 8 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
index 5cc24475e3..ad96c84de8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
@@ -49,8 +49,8 @@ uniform int sun_up_factor;
float pcfShadow(sampler2DShadow shadowMap, vec3 norm, vec4 stc, float bias_mul, vec2 pos_screen, vec3 light_dir)
{
stc.xyz /= stc.w;
- stc.z += shadow_bias * bias_mul* 2.0;
- stc.x = floor(stc.x*shadow_res.x + fract(stc.y*pos_screen.y*pos_screen.x))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
+ 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;
@@ -90,7 +90,9 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
dp_directional_light = clamp(dp_directional_light, 0.0, 1.0);
vec3 shadow_pos = pos.xyz;
- vec3 offset = abs(light_dir.xyz) * (1.0 - dp_directional_light* 0.8);
+
+ vec3 offset = light_dir.xyz * (1.0 - dp_directional_light);
+
shadow_pos += offset * shadow_offset;
vec4 spos = vec4(shadow_pos.xyz, 1.0);
@@ -109,7 +111,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
- shadow += pcfShadow(shadowMap3, norm, lpos, 4.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap3, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
}
@@ -121,7 +123,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
- shadow += pcfShadow(shadowMap2, norm, lpos, 2.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap2, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
}
@@ -153,6 +155,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
{
return 1.0f; // lit beyond the far split...
}
+ shadow = min(dp_directional_light,shadow);
return shadow;
}