diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-28 18:01:12 -0800 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-28 18:01:12 -0800 |
commit | 73c98e1c1e3899aaae1de6bac51f9e21ea6432a1 (patch) | |
tree | 9ba66ed14792191a2abed48f2e0e9ff1227892a4 /indra/newview/app_settings/shaders/class1/lighting | |
parent | c3b37faba3cba425d749345a978ddec16bbd1338 (diff) |
enable basic directional lighting for basic/atmospheric shaders - yay.
next, needs the non-shader GL lighting model to be equally dumb (it's too smart - kill the spot angle.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/lighting')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl index 3e8fdfb3e4..211de830fa 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl @@ -28,7 +28,28 @@ float calcPointLight(vec3 v, vec3 n, vec4 lp, float la) //angular attenuation da *= calcDirectionalLight(n, lv); + + return da; +} + + +float calcPointLight2(vec3 v, vec3 n, vec4 lp, vec3 ln, float la) +{ + //get light vector + vec3 lv = lp.xyz-v; + //get distance + float d = length(lv); + + //normalize light vector + lv *= 1.0/d; + + //distance attenuation + float da = clamp(1.0/(la * d), 0.0, 1.0); + + //angular attenuation + da *= dot(lv, -ln) * calcDirectionalLight(n, lv); + return da; } |