diff options
author | Ptolemy <ptolemy@lindenlab.com> | 2022-07-15 17:31:25 -0700 |
---|---|---|
committer | Ptolemy <ptolemy@lindenlab.com> | 2022-07-15 17:31:25 -0700 |
commit | 35a97efcb713db780399bb6ce1fbb38e517bd570 (patch) | |
tree | 983870233d6d06fa68a6b6fe3378edccc4f4b80f /indra/newview | |
parent | 314f27d1b1701e0fdc4bb983d0f9fd4d4ed6573a (diff) |
SL-17702: PBR: Add PBR materials to point light shaders
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl | 18 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl | 6 |
2 files changed, 21 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index d4e82cebf3..513b748f5f 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -88,6 +88,24 @@ void main() vec3 colorEmissive = spec.rgb; // PBR sRGB Emissive. See: pbropaqueF.glsl vec3 packedORM = texture2DRect(emissiveRect, tc).rgb; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl + vec3 c_diff, reflect0, reflect90; + float alphaRough, specWeight; + initMaterial( diffuse, packedORM, alphaRough, c_diff, reflect0, reflect90, specWeight ); + + for (int light_idx = 0; light_idx < LIGHT_COUNT; ++light_idx) + { + vec3 lightColor = light_col[ light_idx ].rgb; + float lightSize = light [ light_idx ].w; + vec3 lv =(light [ light_idx ].xyz - pos); + calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist); + + if (nl > 0.0 || nv > 0.0) + { + vec3 intensity = getLightIntensityPoint(lightColor, lightSize, lightDist); + colorDiffuse += intensity * nl * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh); + colorSpec += intensity * nl * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh); + } + } final_color = colorDiffuse + colorSpec; } else diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index ddfbafd739..8886abb7d1 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -99,9 +99,9 @@ void main() if (nl > 0.0 || nv > 0.0) { - vec3 intensity = size * color; - colorDiffuse += intensity * nl * BRDFLambertian ( reflect0, reflect90, c_diff , specWeight, vh ); - colorSpec += intensity * nl * BRDFSpecularGGX( reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh ); + vec3 intensity = getLightIntensityPoint(color, size, lightDist); + colorDiffuse += intensity * nl * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh); + colorSpec += intensity * nl * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh); } final_color = colorDiffuse + colorSpec; |