diff options
author | Ptolemy <ptolemy@lindenlab.com> | 2022-07-15 17:29:39 -0700 |
---|---|---|
committer | Ptolemy <ptolemy@lindenlab.com> | 2022-07-15 17:29:39 -0700 |
commit | 314f27d1b1701e0fdc4bb983d0f9fd4d4ed6573a (patch) | |
tree | 15b929fd434273187aa0dcc1456058dd3a418661 /indra/newview/app_settings/shaders/class1 | |
parent | 9b8751a6e425f60cf8cf661b40fec6af1e11ecf8 (diff) |
SL-17702: PBR: Cleanup light shaders to use calcHalfVectors, remove da alias, and unused sa
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index 3427f373d2..4df74b762a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -31,13 +31,25 @@ uniform vec2 screen_res; const float M_PI = 3.14159265; -void calcHalfVectors(vec3 h, vec3 n, vec3 v, out float nh, out float nv, out float vh) -{ -// l = normalize(lv); -// h = normalize(l + v); +// In: +// lv unnormalized surface to light vector +// n normal of the surface +// pos unnormalized camera to surface vector +// Out: +// l normalized surace to light vector +// nl diffuse angle +// nh specular angle +void calcHalfVectors(vec3 lv, vec3 n, vec3 v, + out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist) +{ + l = normalize(lv); + h = normalize(l + v); nh = clamp(dot(n, h), 0.0, 1.0); + nl = clamp(dot(n, l), 0.0, 1.0); nv = clamp(dot(n, v), 0.0, 1.0); vh = clamp(dot(v, h), 0.0, 1.0); + + lightDist = length(lv); } vec2 getScreenCoordinate(vec2 screenpos) |