summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2022-08-09 01:10:06 -0700
committerPtolemy <ptolemy@lindenlab.com>2022-08-09 01:10:06 -0700
commit38b895162ccd15281c214dccd54bacb0c6485c5a (patch)
treef3494e7978f70649218b3be8b558f3f3506c8bdf /indra/newview/app_settings/shaders/class3
parent9e84c634701dc754b843e387a04cdf2bb2d0d9ba (diff)
SL-17763: PBR: Add debug spot light vectors
Diffstat (limited to 'indra/newview/app_settings/shaders/class3')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl81
1 files changed, 81 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
index 20309d9673..eed714c8db 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
@@ -38,6 +38,21 @@
#define DEBUG_SPOT_SPEC_POS 0
#define DEBUG_SPOT_REFLECTION 0
+#define DEBUG_PBR_LIGHT_H 0 // Half vector
+#define DEBUG_PBR_LIHGT_L 0 // Light vector
+#define DEBUG_PBR_LIGHT_NH 0 // dot(n,h)
+#define DEBUG_PBR_LIGHT_NL 0 // doh(n,l)
+#define DEBUG_PBR_LIGHT_NV 0 // doh(n,v)
+#define DEBUG_PBR_LIGHT_VH 0 // doh(v,h)
+#define DEBUG_PBR_LIGHT_DIFFUSE_COLOR 0 // non PBR spotlight
+#define DEBUG_PBR_LIGHT_SPECULAR_COLOR 0 // non PBR spotlight
+#define DEBUG_PBR_LIGHT_INTENSITY 0 // Light intensity
+#define DEBUG_PBR_LIGHT_INTENSITY_NL 0 // Light intensity * dot(n,l)
+#define DEBUG_PBR_LIGHT_BRDF_DIFFUSE 0
+#define DEBUG_PBR_LIGHT_BRDF_SPECULAR 0
+#define DEBUG_PBR_LIGHT_BRDF_FINAL 0 // BRDF Diffuse + BRDF Specular
+#define DEBUG_PBR_SHADOW 0 // Show inverted shadow
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
@@ -96,6 +111,13 @@ void initMaterial( vec3 diffuse, vec3 packedORM, out float alphaRough, out vec3
vec3 srgb_to_linear(vec3 cs);
vec4 texture2DLodSpecular(vec2 tc, float lod);
+vec3 colorized_dot(float x)
+{
+ if (x > 0.0) return vec3( 0, x, 0 );
+ if (x < 0.0) return vec3( x, 0, 0 );
+ return vec3( 0, 0, 1 );
+}
+
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
@@ -212,6 +234,65 @@ void main()
colorDiffuse = vec3(0.5); colorSpec = vec3(0);
#endif
+ #if DEBUG_PBR_LIGHT_H
+ colorDiffuse = h*0.5 + 0.5; colorSpec = vec3(0);
+ #endif
+ #if DEBUG_PBR_LIHGT_L
+ colorDiffuse = l*0.5 + 0.5; colorSpec = vec3(0);
+ #endif
+ #if DEBUG_PBR_LIGHT_NH
+ colorDiffuse = colorized_dot(nh); colorSpec = vec3(0);
+ #endif
+ #if DEBUG_PBR_LIGHT_NL
+ colorDiffuse = colorized_dot(nl); colorSpec = vec3(0);
+ #endif
+ #if DEBUG_PBR_LIGHT_NV
+ colorDiffuse = colorized_dot(nv); colorSpec = vec3(0);
+ #endif
+ #if DEBUG_PBR_LIGHT_VH
+ colorDiffuse = colorized_dot(vh); colorSpec = vec3(0);
+ #endif
+ #if DEBUG_PBR_LIGHT_DIFFUSE_COLOR
+ colorDiffuse = dlit;
+ #endif
+ #if DEBUG_PBR_LIGHT_SPECULAR_COLOR
+ colorDiffuse = slit;
+ #endif
+ #if DEBUG_PBR_LIGHT_INTENSITY
+ colorDiffuse = getLightIntensitySpot( color, size, lightDist, v ); colorSpec = vec3(0);
+// colorDiffuse = nl * dist_atten;
+ #endif
+ #if DEBUG_PBR_LIGHT_INTENSITY_NL
+ colorDiffuse = getLightIntensitySpot( color, size, lightDist, v ) * nl; colorSpec = vec3(0);
+ #endif
+ #if DEBUG_PBR_LIGHT_BRDF_DIFFUSE
+ vec3 c_diff, reflect0, reflect90;
+ float alphaRough, specWeight;
+ initMaterial( diffuse, packedORM, alphaRough, c_diff, reflect0, reflect90, specWeight );
+
+ colorDiffuse = BRDFLambertian ( reflect0, reflect90, c_diff , specWeight, vh );
+ colorSpec = vec3(0);
+ #endif
+ #if DEBUG_PBR_LIGHT_BRDF_SPECULAR
+ vec3 c_diff, reflect0, reflect90;
+ float alphaRough, specWeight;
+ initMaterial( diffuse, packedORM, alphaRough, c_diff, reflect0, reflect90, specWeight );
+
+ colorDiffuse = vec3(0);
+ colorSpec = BRDFSpecularGGX( reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh );
+ #endif
+ #if DEBUG_PBR_LIGHT_BRDF_FINAL
+ vec3 c_diff, reflect0, reflect90;
+ float alphaRough, specWeight;
+ initMaterial( diffuse, packedORM, alphaRough, c_diff, reflect0, reflect90, specWeight );
+ colorDiffuse = nl * BRDFLambertian ( reflect0, reflect90, c_diff , specWeight, vh );
+ colorSpec = nl * BRDFSpecularGGX( reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh );
+ #endif
+ #if DEBUG_PBR_SHADOW
+ colorDiffuse = 1.0 - vec3(shadow);
+ colorSpec = vec3(0);
+ #endif
+
final_color = colorDiffuse + colorSpec;
}
else