From e3c376d3812f8a2f3868f5baa71fffc785f35911 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 14 Feb 2019 16:33:20 -0800 Subject: SL-10552 Fix view-dependent peter-panning from incorrectly biased shadow pos offset. --- .../app_settings/shaders/class1/deferred/shadowUtil.glsl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'indra') 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) -- cgit v1.2.3