summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2022-08-24 16:07:18 -0700
committerPtolemy <ptolemy@lindenlab.com>2022-08-24 16:07:18 -0700
commit5a346844df747ada7468c5814c2d1cd7c5d74f60 (patch)
tree13b16b8028dbf8e09c88539dd8f57cdd88aa6790 /indra
parent7c72b4be8c40f4963d4b51385ff0bc13da9a7c9e (diff)
SL-17703: PBR: Add debug ability to turn sun/off, view sun contrib
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl62
1 files changed, 50 insertions, 12 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index e072748e8a..8ee8210fb8 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -25,6 +25,7 @@
#define PBR_USE_ATMOS 1
#define PBR_USE_IBL 1
+#define PBR_USE_SUN 1
#define DEBUG_PBR_LIGHT_TYPE 0 // Output no global light to make it easier to see pointLight and spotLight
#define DEBUG_PBR_PACKORM0 0 // Rough=0, Metal=0
@@ -68,7 +69,7 @@
// IBL Diffuse
#define DEBUG_PBR_DIFFUSE_C 0 // Output: diffuse non metal mix
#define DEBUG_PBR_IRRADIANCE_RAW 0 // Output: Diffuse Irradiance pre-mix
-#define DEBUG_PBR_IRRADIANCE 0 // Output: Diffuse Irradiance
+#define DEBUG_PBR_IRRADIANCE 0 // Output: Diffuse Irradiance, NOTE: SSAO is factored in
#define DEBUG_PBR_FSS_ESS_LAMBERT 0 // Output: FssEssLambert
#define DEBUG_PBR_EMS 0 // Output: Ems = (1 - BRDF Scale + BRDF Bias)
#define DEBUG_PBR_AVG 0 // Output: Avg
@@ -89,6 +90,10 @@
// Sun
#define DEBUG_PBR_SUN_FULL_BRIGHT 0 // Sunlit color = <1,1,1>
+#define DEBUG_PBR_SUN_OUT_DIFFUSE 0 // Final sun diffuse : intensity * nl * diffuse
+#define DEBUG_PBR_SUN_OUT_SPECULAR 0 // Final sun specular: intensity * nl * specular
+#define DEBUG_PBR_SUN_LAMBERT 0 // BRDF Diffuse: Lambertian Diffuse color
+#define DEBUG_PBR_SUN_LAMBERT_NL 0 // BRDF Diffuse: nl * Lambertian Diffuse color
#define DEBUG_PBR_SUN_H 0 // Half Vector
#define DEBUG_PBR_SUN_L 0 // Light Vector
#define DEBUG_PBR_SUN_V 0 // Surface to Light Vector
@@ -103,8 +108,8 @@
#define DEBUG_PBR_SUN_SPEC_DF 0 // D() * F()
#define DEBUG_PBR_SUN_SPEC_DV 0 // D() * V()
#define DEBUG_PBR_SUN_SPEC_FV 0 // F() * V()
-#define DEBUG_PBR_SUN_SPECULAR 0 // D() * F() * V()
-#define DEBUG_PBR_SUN_SPEC_FUNC 0 // D() * F() * V()
+#define DEBUG_PBR_SUN_SPEC_DFV 0 // D() * F() * V()
+#define DEBUG_PBR_SUN_SPEC_NL_DFV 0 // nl * D() * F() * V()
#define DEBUG_PBR_IOR 0 // Output: grayscale IOR
#define DEBUG_PBR_REFLECT0_BASE 0 // Output: black reflect0 default from ior
@@ -353,63 +358,96 @@ void main()
if (nl > 0.0 || nv > 0.0)
{
+ vec3 sunColor = sunlit * 2.0; // Midday should have strong sunlight
#if DEBUG_PBR_SUN_FULL_BRIGHT
- vec3 sunlit = vec3(1);
+ sunColor = vec3(1);
#endif
// scol = sun shadow
- vec3 intensity = ambocc * sunlit * nl * scol;
- colorDiffuse += intensity * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
- colorSpec += intensity * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh);
- bloom = dot(colorSpec, colorSpec) / 8.0;
+ vec3 intensity = ambocc * sunColor * nl * scol;
+ vec3 sunDiffuse = intensity * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
+ vec3 sunSpec = intensity * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh);
+ bloom = dot(sunSpec, sunSpec) / 8.0;
#if DEBUG_PBR_SUN_SPEC_FRESNEL
colorDiffuse = vec3(0);
colorSpec = fresnelSchlick( reflect0, reflect90, vh );
+ bloom = 0;
#endif
#if DEBUG_PBR_SUN_SPEC_D
colorDiffuse = vec3(0);
colorSpec = vec3(D_GGX( nh, alphaRough ));
+ bloom = 0;
#endif
#if DEBUG_PBR_SUN_SPEC_V
colorDiffuse = vec3(0);
colorSpec = vec3(V_GGX( nl, nv, alphaRough ));
+ bloom = 0;
#endif
#if DEBUG_PBR_SUN_SPEC_DF
colorDiffuse = vec3(0);
colorSpec = fresnelSchlick( reflect0, reflect90, vh );
colorSpec *= D_GGX( nh, alphaRough );
+ bloom = 0;
#endif
#if DEBUG_PBR_SUN_SPEC_DV
colorDiffuse = vec3(0);
colorSpec = vec3(D_GGX( nh, alphaRough ));
colorSpec *= vec3(V_GGX( nl, nv, alphaRough ));
+ bloom = 0;
#endif
#if DEBUG_PBR_SUN_SPEC_FV
colorDiffuse = vec3(0);
colorSpec = fresnelSchlick( reflect0, reflect90, vh );
colorSpec *= V_GGX( nl, nv, alphaRough );
+ bloom = 0;
#endif
- #if DEBUG_PBR_SUN_SPECULAR
+ #if DEBUG_PBR_SUN_SPEC_DFV
colorDiffuse = vec3(0);
colorSpec = fresnelSchlick( reflect0, reflect90, vh );
colorSpec *= D_GGX( nh, alphaRough );
colorSpec *= V_GGX( nl, nv, alphaRough );
+ bloom = 0;
#endif
- #if DEBUG_PBR_SUN_SPEC_FUNC
+ #if DEBUG_PBR_SUN_SPEC_NL_DFV
colorDiffuse = vec3(0);
colorSpec = nl * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh);
#endif
+ #if DEBUG_PBR_SUN_FINAL
+ colorDiffuse = nl * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
+ colorSpec = nl * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh);
+ #endif
- #if DEBUG_PBR_SUN_DIFFUSE
- colorDiffuse = linear_to_srgb(diffuse.rgb);
+ #if DEBUG_PBR_SUN_OUT_DIFFUSE
+ colorDiffuse = linear_to_srgb(sunDiffuse);
+ colorSpec = vec3(0);
+ bloom = 0.0;
+ #endif
+ #if DEBUG_PBR_SUN_OUT_SPECULAR
+ colorDiffuse = linear_to_srgb(sunSpec);
colorSpec = vec3(0);
#endif
#if DEBUG_PBR_SUN_REFLECT0
colorDiffuse = reflect0;
colorSpec = vec3(0);
#endif
+
+#if PBR_USE_SUN
+ colorDiffuse += sunDiffuse;
+ colorSpec += sunSpec;
+#endif
}
+#if DEBUG_PBR_SUN_LAMBERT
+ colorDiffuse = BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
+ colorSpec = vec3(0);
+ bloom = 0;
+#endif
+#if DEBUG_PBR_SUN_LAMBERT_NL
+ colorDiffuse = nl * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
+ colorSpec = vec3(0);
+ bloom = 0;
+#endif
+
#if DEBUG_PBR_SUN_H
colorDiffuse = h*0.5 + 0.5; colorSpec = vec3(0);
#endif