diff options
author | Oz Linden <oz@lindenlab.com> | 2013-01-28 16:22:21 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2013-01-28 16:22:21 -0500 |
commit | d56de96086c8e0b114f5a503b6377c3f56fc738c (patch) | |
tree | 298f829521f8b4b4d65d2405fc65fa41bb4961cf /indra/newview/app_settings | |
parent | 6c667b8c3372505b17385efaac7c0e758b29a1a7 (diff) | |
parent | cc7ae8fbd1fc249f77ced95171e5c22e48adedb6 (diff) |
merge linearlize lighting
Diffstat (limited to 'indra/newview/app_settings')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl | 13 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl | 16 |
2 files changed, 22 insertions, 7 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 9e194cdcd1..ad50690c02 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -123,13 +123,20 @@ void main() if (spec.a > 0.0) { //vec3 ref = dot(pos+lv, norm); + vec3 h = normalize(lv+npos); + float nh = dot(norm, h); + float nv = dot(norm, npos); + float vh = dot(npos, h); + float sa = nh; + vec3 fres = spec.rgb + pow(1 - dot(h, npos), 5) * (1 - spec.rgb); + float gtdenom = 2 * nh; + float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - float sa = dot(normalize(lv+npos),norm); if (sa > 0.0) { - sa = texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0); - col += da*sa*light_col[i].rgb*spec.rgb; + vec3 scol = (fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt) / (nh * da); + col += lit*scol*light_col[i].rgb; } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index fa1572e692..03b036375b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -107,12 +107,20 @@ void main() vec4 spec = texture2DRect(specularRect, frag.xy); if (spec.a > 0.0) { - float sa = dot(normalize(lv-normalize(pos)),norm); - spec.rgb += pow(1 - dot(-normalize(pos), norm), 2) * da * 3; + vec3 npos = -normalize(pos); + vec3 h = normalize(lv+npos); + float nh = dot(norm, h); + float nv = dot(norm, npos); + float vh = dot(npos, h); + float sa = nh; + vec3 fres = spec.rgb + pow(1 - dot(h, npos), 5) * (1 - spec.rgb); + float gtdenom = 2 * nh; + float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh))); + if (sa > 0.0) { - sa = texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0); - col += da*sa*color.rgb*spec.rgb; + vec3 scol = (fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt) / (nh * da); + col += lit*scol*color.rgb; } } |