summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3/deferred
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2022-08-11 15:26:51 -0700
committerPtolemy <ptolemy@lindenlab.com>2022-08-11 15:26:51 -0700
commit8abc2ad094c150479530d2c8d99ceb7c484497d7 (patch)
treefce0bb7d806328caae3427d72f1c54549a25e361 /indra/newview/app_settings/shaders/class3/deferred
parent3bb347967b12ede1f4d7348b607497e8a942a3dd (diff)
SL-17929: PBR: Add sun/moon reflection in surface
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl10
1 files changed, 10 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index c2a3e472d0..e3608a1136 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -319,6 +319,16 @@ void main()
#endif
colorDiffuse *= packedORM.r; // Occlusion -- NOTE: pbropaque will need occlusion_strength pre-multiplied into spec.r
+ // Add in sun/moon reflection
+ if (metal > 0.0)
+ {
+ vec3 r = reflect(pos.xyz, norm.xyz);
+ float sa = dot(normalize(r), light_dir.xyz);
+ float sun = texture2D(lightFunc, vec2(sa, metal)).r;
+ vec3 sunSpec = sunlit * scol * sun;
+ colorSpec += sunSpec;
+ bloom = dot(sunSpec, sunSpec) / 6;
+ }
color.rgb = colorDiffuse + colorEmissive + colorSpec;
vec3 sun_contrib = min(da, scol) * sunlit;