summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-02-14 16:33:20 -0800
committerGraham Linden <graham@lindenlab.com>2019-02-14 16:33:20 -0800
commite3c376d3812f8a2f3868f5baa71fffc785f35911 (patch)
tree84320cac6e564b79342773906d0efd75aa9e7e21 /indra
parent65927e0a76aaf8ff4dc268acdb12007265ff3a14 (diff)
SL-10552
Fix view-dependent peter-panning from incorrectly biased shadow pos offset.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl10
1 files changed, 4 insertions, 6 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
index d04ac6851a..5cc24475e3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
@@ -81,20 +81,18 @@ float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x*2.0, -off.y, 0.0)).x;
return shadow*0.2;
}
-
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
{
float shadow = 0.0f;
- vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
+ vec3 light_dir = normalize((sun_up_factor == 1) ? sun_dir : moon_dir);
- float dp_sun = max(0.0, dot(sun_dir.xyz, norm));
- float dp_moon = max(0.0, dot(moon_dir.xyz, norm));
- float dp_directional_light = (sun_up_factor == 1) ? dp_sun : dp_moon;
+ float dp_directional_light = max(0.0, dot(norm.xyz, light_dir));
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);
- shadow_pos += offset;
+ shadow_pos += offset * shadow_offset;
+
vec4 spos = vec4(shadow_pos.xyz, 1.0);
if (spos.z > -shadow_clip.w)