diff options
author | Dave Parks <davep@lindenlab.com> | 2011-08-19 16:34:34 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-08-19 16:34:34 -0500 |
commit | 233e42b3314c17b2e24334587d960af6e3dc963c (patch) | |
tree | 480e571bf913bb0743c3c6c6ce846a69aa405504 /indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl | |
parent | 0e496309d6cb7581c9f69b7da244699c382750ac (diff) | |
parent | 80398b3ccb0c4a6ff3ac20b3565619fe5cecc2f9 (diff) |
merge
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 85b0ce5beb..c42935d815 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -55,7 +55,10 @@ uniform float sun_wash; uniform int proj_shadow_idx; uniform float shadow_fade; -varying vec4 vary_light; +uniform vec3 center; +uniform vec3 color; +uniform float falloff; +uniform float size; varying vec4 vary_fragcoord; uniform vec2 screen_res; @@ -110,7 +113,7 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) vec4 getPosition(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); @@ -129,9 +132,9 @@ void main() frag.xy *= screen_res; vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = vary_light.xyz-pos.xyz; + vec3 lv = center.xyz-pos.xyz; float dist2 = dot(lv,lv); - dist2 /= vary_light.w; + dist2 /= size; if (dist2 > 1.0) { discard; @@ -145,16 +148,16 @@ void main() vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); if (proj_tc.z < 0.0) { - discard; + //discard; } proj_tc.xyz /= proj_tc.w; - float fa = gl_Color.a+1.0; + float fa = falloff+1.0; float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); if (dist_atten <= 0.0) { - discard; + //discard; } lv = proj_origin-pos.xyz; @@ -182,7 +185,7 @@ void main() vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + vec3 lcol = color.rgb * plcol.rgb * plcol.a; lit = da * dist_atten * noise; @@ -199,7 +202,7 @@ void main() amb_da = min(amb_da, 1.0-lit); - col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; } @@ -232,7 +235,7 @@ void main() stc.y > 0.0) { vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb; + col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb; } } } |