diff options
author | Igor Borovkov <iborovkov@productengine.com> | 2009-12-22 17:49:35 +0200 |
---|---|---|
committer | Igor Borovkov <iborovkov@productengine.com> | 2009-12-22 17:49:35 +0200 |
commit | 191e5f9ca033cd1520950f35309c0bc2c4499803 (patch) | |
tree | 684ccc50f33104413f9c52fe2ee4c3302ec77bb6 /indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl | |
parent | 304e321f89e9a517ba90d6b41999a65591639ad9 (diff) | |
parent | d4a8f4c6efd11b4cb3ccba320f18e8508668b915 (diff) |
merge
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl index 28908a311d..0fad5b4b50 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl @@ -10,7 +10,6 @@ uniform sampler2DRect depthMap; uniform sampler2DRect normalMap; uniform sampler2DRect lightMap; -uniform sampler2DRect edgeMap; uniform float dist_factor; uniform float blur_size; @@ -46,53 +45,36 @@ void main() dlt /= max(-pos.z*dist_factor, 1.0); - vec2 defined_weight = kern[0].xy; // special case the kern[0] (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' + vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' vec4 col = defined_weight.xyxx * ccol; - - float center_e = 1.0 - (texture2DRect(edgeMap, vary_fragcoord.xy).a+ - texture2DRect(edgeMap, vary_fragcoord.xy+dlt*0.333).a+ - texture2DRect(edgeMap, vary_fragcoord.xy-dlt*0.333).a); - float e = center_e; for (int i = 1; i < 4; i++) { vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; - - e = max(e, 0.0); - - vec2 wght = kern[i].xy*e; - - col += texture2DRect(lightMap, tc)*wght.xyxx; - defined_weight += wght; - - e *= e; - e -= texture2DRect(edgeMap, tc.xy).a+ - texture2DRect(edgeMap, tc.xy+dlt*0.333).a+ - texture2DRect(edgeMap, tc.xy-dlt*0.333).a; + vec3 samppos = getPosition(tc).xyz; + float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane + if (d*d <= 0.003) + { + col += texture2DRect(lightMap, tc)*kern[i].xyxx; + defined_weight += kern[i].xy; + } } - - e = center_e; for (int i = 1; i < 4; i++) { vec2 tc = vary_fragcoord.xy - kern[i].z*dlt; - - e = max(e, 0.0); - - vec2 wght = kern[i].xy*e; - - col += texture2DRect(lightMap, tc)*wght.xyxx; - defined_weight += wght; - - e *= e; - e -= texture2DRect(edgeMap, tc.xy).a+ - texture2DRect(edgeMap, tc.xy+dlt*0.333).a+ - texture2DRect(edgeMap, tc.xy-dlt*0.333).a; + vec3 samppos = getPosition(tc).xyz; + float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane + if (d*d <= 0.003) + { + col += texture2DRect(lightMap, tc)*kern[i].xyxx; + defined_weight += kern[i].xy; + } } + col /= defined_weight.xyxx; gl_FragColor = col; - - //gl_FragColor = ccol; } + |