summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl42
1 files changed, 19 insertions, 23 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 8db4cb58cf..12706f130b 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -34,10 +34,10 @@ out vec4 frag_color;
VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0;
-uniform sampler2DRectShadow shadowMap0;
-uniform sampler2DRectShadow shadowMap1;
-uniform sampler2DRectShadow shadowMap2;
-uniform sampler2DRectShadow shadowMap3;
+uniform sampler2DShadow shadowMap0;
+uniform sampler2DShadow shadowMap1;
+uniform sampler2DShadow shadowMap2;
+uniform sampler2DShadow shadowMap3;
uniform sampler2DRect depthMap;
uniform mat4 shadow_matrix[6];
@@ -58,22 +58,22 @@ uniform float shadow_bias;
uniform mat4 inv_proj;
-float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc)
+float pcfShadow(sampler2DShadow shadowMap, vec4 stc)
{
stc.xyz /= stc.w;
stc.z += shadow_bias;
-
- stc.x = floor(stc.x + fract(stc.y*12345)); // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
+
+ stc.x = floor(stc.x*shadow_res.x + fract(stc.y*shadow_res.y*12345))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
- float cs = shadow2DRect(shadowMap, stc.xyz).x;
+ float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs;
-
- shadow += shadow2DRect(shadowMap, stc.xyz+vec3(2.0, 1.5, 0.0)).x;
- shadow += shadow2DRect(shadowMap, stc.xyz+vec3(1.0, -1.5, 0.0)).x;
- shadow += shadow2DRect(shadowMap, stc.xyz+vec3(-1.0, 1.5, 0.0)).x;
- shadow += shadow2DRect(shadowMap, stc.xyz+vec3(-2.0, -1.5, 0.0)).x;
-
- return shadow*0.2;
+
+ 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.2;
}
@@ -99,8 +99,7 @@ void main()
if (spos.z < near_split.z)
{
lpos = shadow_matrix[3]*spos;
- lpos.xy *= shadow_res;
-
+
float w = 1.0;
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
shadow += pcfShadow(shadowMap3, lpos)*w;
@@ -111,8 +110,7 @@ void main()
if (spos.z < near_split.y && spos.z > far_split.z)
{
lpos = shadow_matrix[2]*spos;
- lpos.xy *= shadow_res;
-
+
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;
@@ -123,8 +121,7 @@ void main()
if (spos.z < near_split.x && spos.z > far_split.y)
{
lpos = shadow_matrix[1]*spos;
- lpos.xy *= shadow_res;
-
+
float w = 1.0;
w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
@@ -135,8 +132,7 @@ void main()
if (spos.z > far_split.x)
{
lpos = shadow_matrix[0]*spos;
- lpos.xy *= shadow_res;
-
+
float w = 1.0;
w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;