diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
5 files changed, 28 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl index 4366376d99..edec83ea07 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl @@ -12,7 +12,7 @@ uniform sampler2DMS depthMap; uniform sampler2DMS normalMap; -uniform sampler2DMS lightMap; +uniform sampler2DRect lightMap; uniform float dist_factor; uniform float blur_size; @@ -25,12 +25,23 @@ varying vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; -vec4 texture2DMS(sampler2DMS tex, ivec2 tc) +vec3 texture2DMS3(sampler2DMS tex, ivec2 tc) { - vec4 ret = vec4(0,0,0,0); + vec3 ret = vec3(0,0,0); for (int i = 0; i < samples; i++) { - ret += texelFetch(tex, tc, i); + ret += texelFetch(tex, tc, i).rgb; + } + + return ret/samples; +} + +float texture2DMS1(sampler2DMS tex, ivec2 tc) +{ + float ret = 0; + for (int i = 0; i < samples; i++) + { + ret += texelFetch(tex, tc, i).r; } return ret/samples; @@ -38,7 +49,7 @@ vec4 texture2DMS(sampler2DMS tex, ivec2 tc) vec4 getPosition(ivec2 pos_screen) { - float depth = texture2DMS(depthMap, pos_screen.xy).r; + float depth = texture2DMS1(depthMap, pos_screen.xy); vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); @@ -54,10 +65,10 @@ void main() vec2 tc = vary_fragcoord.xy; ivec2 itc = ivec2(tc); - vec3 norm = texture2DMS(normalMap, itc).xyz; + vec3 norm = texture2DMS3(normalMap, itc).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm vec3 pos = getPosition(itc).xyz; - vec4 ccol = texture2DMS(lightMap, itc).rgba; + vec4 ccol = texture2DRect(lightMap, tc).rgba; vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); dlt /= max(-pos.z*dist_factor, 1.0); @@ -73,23 +84,23 @@ void main() for (int i = 1; i < 4; i++) { - ivec2 samptc = ivec2(tc + kern[i].z*dlt); - vec3 samppos = getPosition(samptc).xyz; + vec2 samptc = tc + kern[i].z*dlt; + vec3 samppos = getPosition(ivec2(samptc)).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane if (d*d <= pointplanedist_tolerance_pow2) { - col += texture2DMS(lightMap, samptc)*kern[i].xyxx; + col += texture2DRect(lightMap, samptc)*kern[i].xyxx; defined_weight += kern[i].xy; } } for (int i = 1; i < 4; i++) { - ivec2 samptc = ivec2(tc - kern[i].z*dlt); - vec3 samppos = getPosition(samptc).xyz; + vec2 samptc = vec2(tc - kern[i].z*dlt); + vec3 samppos = getPosition(ivec2(samptc)).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane if (d*d <= pointplanedist_tolerance_pow2) { - col += texture2DMS(lightMap, samptc)*kern[i].xyxx; + col += texture2DRect(lightMap, samptc)*kern[i].xyxx; defined_weight += kern[i].xy; } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl index 16e97109f9..66c7a5cb4a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl @@ -130,7 +130,7 @@ void main() discard; } - gl_FragColor.rgb = fcol/wght; + gl_FragColor.rgb = fcol/samples; gl_FragColor.a = 0.0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl index bdaa8e59c4..b450ff1ca2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl @@ -34,7 +34,6 @@ uniform float far_clip; uniform vec3 proj_origin; //origin of projection to be used for angular attenuation uniform float sun_wash; -uniform int proj_shadow_idx; uniform float shadow_fade; varying vec4 vary_light; @@ -228,6 +227,6 @@ void main() discard; } - gl_FragColor.rgb = fcol/wght; + gl_FragColor.rgb = fcol/samples; gl_FragColor.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl index 23b5e76735..7521c3310c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl @@ -103,6 +103,6 @@ void main() discard; } - gl_FragColor.rgb = fcol/wght; + gl_FragColor.rgb = fcol/samples; gl_FragColor.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl index 3a9d9266bb..6702bd5014 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl @@ -229,6 +229,6 @@ void main() discard; } - gl_FragColor.rgb = fcol/wght; + gl_FragColor.rgb = fcol/samples; gl_FragColor.a = 0.0; } |