diff options
author | Graham Linden <graham@lindenlab.com> | 2018-11-09 18:31:29 +0000 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-11-09 18:31:29 +0000 |
commit | db270df7cc00c1e2519749831e7e98c2c10e3ee6 (patch) | |
tree | 7638f00884b1b2ec7ee4d08159ddcb967db9a928 /indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl | |
parent | 2929998982f37221a58b9fa8037748a2e905f4b1 (diff) |
Back out changes causing broken shadows and other render shenanigans.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index c4018ca61a..aa5e99a2f7 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -67,9 +67,20 @@ uniform float shadow_offset; uniform float spot_shadow_bias; uniform float spot_shadow_offset; -vec3 getNorm(vec2 pos_screen); vec3 decode_normal (vec2 enc); -vec4 getPosition(vec2 pos_screen); + +vec4 getPosition(vec2 pos_screen) +{ + float depth = texture2DRect(depthMap, pos_screen.xy).r; + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen) { @@ -112,9 +123,14 @@ float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_scr void main() { - vec2 pos_screen = vary_fragcoord.xy; - vec4 pos = getPosition(pos_screen); - vec3 norm = getNorm(pos_screen); + vec2 pos_screen = vary_fragcoord.xy; + + //try doing an unproject here + + vec4 pos = getPosition(pos_screen); + + vec3 norm = texture2DRect(normalMap, pos_screen).xyz; + norm = decode_normal(norm.xy); // unpack norm /*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL { |