diff options
author | Ptolemy <ptolemy@lindenlab.com> | 2022-08-22 15:52:43 -0700 |
---|---|---|
committer | Ptolemy <ptolemy@lindenlab.com> | 2022-08-22 15:52:43 -0700 |
commit | e6171a8d097b2ac0242a29dcd78e297da27d7c97 (patch) | |
tree | 6fd07b0f658e3fd2f0e6a16b119ef0ec31294eb7 /indra/newview/app_settings/shaders/class3/deferred | |
parent | b8c46f9615bffa0e6aeb909924c39581b160fdef (diff) |
SL-17975: PBR: Add light debugging
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred')
4 files changed, 55 insertions, 14 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index 399948459b..d8e1bba5d8 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -27,7 +27,10 @@ /*[EXTRA_CODE_HERE]*/ -#define DEBUG_PBR_LIGHT_TYPE 0 +#define DEBUG_ANY_LIGHT_TYPE 0 // Output red light cone +#define DEBUG_PBR_LIGHT_TYPE 0 // Output PBR objects in red +#define DEBUG_LEG_LIGHT_TYPE 0 // Show Legacy objects in red +#define DEBUG_POINT_ZERO 0 // Output zero for spotlight #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; @@ -115,7 +118,7 @@ void main() } #if DEBUG_PBR_LIGHT_TYPE - colorDiffuse = vec3(0,0.5,0); colorSpec = vec3(0); + colorDiffuse = vec3(0.5,0,0); colorSpec = vec3(0); #endif final_color = colorDiffuse + colorSpec; } @@ -175,8 +178,18 @@ void main() } } } + #if DEBUG_LEG_LIGHT_TYPE + final_color.rgb = vec3(0.5,0,0.0); + #endif } +#if DEBUG_POINT_ZERO + final_color = vec3(0); +#endif +#if DEBUG_ANY_LIGHT_TYPE + final_color = vec3(0.3333,0,0); +#endif + frag_color.rgb = final_color; frag_color.a = 0.0; #endif // LOCAL_LIGHT_KILL diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl index fdbeb34116..a9a2b8dcb4 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl @@ -28,8 +28,9 @@ /*[EXTRA_CODE_HERE]*/ +#define DEBUG_ANY_LIGHT_TYPE 0 // Output blue light cone +#define DEBUG_LEG_LIGHT_TYPE 0 // Show Legacy objects in blue #define DEBUG_PBR_LIGHT_TYPE 0 // Ouput gray if PBR multiSpot lights object -#define DEBUG_PBR_SPOT_ZERO 0 // Output zero for spotlight #define DEBUG_PBR_SPOT 0 #define DEBUG_PBR_SPOT_DIFFUSE 0 // PBR diffuse lit #define DEBUG_PBR_SPOT_SPECULAR 0 // PBR spec lit @@ -44,6 +45,7 @@ #define DEBUG_SPOT_NL 0 // monochome area effected by light #define DEBUG_SPOT_SPEC_POS 0 #define DEBUG_SPOT_REFLECTION 0 // color: pos reflected along n +#define DEBUG_SPOT_ZERO 0 // Output zero for spotlight #define DEBUG_PBR_LIGHT_H 0 // Half vector #define DEBUG_PBR_LIHGT_L 0 // Light vector @@ -108,6 +110,7 @@ uniform mat4 inv_proj; vec3 BRDFLambertian( vec3 reflect0, vec3 reflect90, vec3 c_diff, float specWeight, float vh ); vec3 BRDFSpecularGGX( vec3 reflect0, vec3 reflect90, float alphaRoughness, float specWeight, float vh, float nl, float nv, float nh ); 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); +vec3 colorized_dot(float x); bool clipProjectedLightVars(vec3 center, vec3 pos, out float dist, out float l_dist, out vec3 lv, out vec4 proj_tc ); vec3 getLightIntensitySpot(vec3 lightColor, float lightRange, float lightDistance, vec3 v); vec4 getNormalEnvIntensityFlags(vec2 screenpos, out vec3 n, out float envIntensity); @@ -119,13 +122,6 @@ 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 getPosition(vec2 pos_screen); void main() @@ -238,7 +234,7 @@ void main() } #if DEBUG_PBR_LIGHT_TYPE - colorDiffuse = vec3(0.5); colorSpec = vec3(0); + colorDiffuse = vec3(0.5,0,0); colorSpec = vec3(0); #endif #if DEBUG_PBR_LIGHT_H @@ -324,6 +320,9 @@ void main() amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, noise, proj_tc.xy ); final_color += diffuse.rgb * amb_rgb; +#if DEBUG_LEG_LIGHT_TYPE + final_color = vec3(0,0,0.5); +#endif } if (spec.a > 0.0) @@ -418,7 +417,10 @@ void main() final_color = reflect(normalize(pos), n); #endif #if DEBUG_SPOT_ZERO - final_color = vec3(0); + final_color = vec3(0,0,0); +#endif +#if DEBUG_ANY_LIGHT_TYPE + final_color = vec3(0,0,0.3333); #endif //not sure why, but this line prevents MATBUG-194 diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 42d7407456..a1298a8409 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -27,7 +27,10 @@ /*[EXTRA_CODE_HERE]*/ -#define DEBUG_PBR_LIGHT_TYPE 0 +#define DEBUG_ANY_LIGHT_TYPE 0 // Output magenta light cone +#define DEBUG_LEG_LIGHT_TYPE 0 // Show Legacy objects in green +#define DEBUG_PBR_LIGHT_TYPE 0 // Show PBR objects in blue +#define DEBUG_POINT_ZERO 0 // Output zero for point light #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; @@ -156,8 +159,19 @@ void main() { discard; } + +#if DEBUG_LEG_LIGHT_TYPE + final_color.rgb = vec3(0,0.25,0); +#endif } +#if DEBUG_POINT_ZERO + final_color = vec3(0); +#endif +#if DEBUG_ANY_LIGHT_TYPE + final_color = vec3(0.25,0,0.25); +#endif + frag_color.rgb = final_color; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index d82baf0804..41e40a07e7 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -28,12 +28,15 @@ /*[EXTRA_CODE_HERE]*/ -#define DEBUG_PBR_LIGHT_TYPE 0 +#define DEBUG_ANY_LIGHT_TYPE 0 // Output green light cone +#define DEBUG_LEG_LIGHT_TYPE 0 // Show Legacy objects in green +#define DEBUG_PBR_LIGHT_TYPE 0 // Show PBR objects in green #define DEBUG_PBR_SPOT 0 #define DEBUG_PBR_SPOT_DIFFUSE 0 #define DEBUG_PBR_SPOT_SPECULAR 0 #define DEBUG_SPOT_NL 0 // monochome area effected by light +#define DEBUG_SPOT_ZERO 0 // Output zero for spotlight #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; @@ -223,6 +226,9 @@ void main() vec3 amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, noise, proj_tc.xy ); final_color += diffuse.rgb*amb_rgb; + #if DEBUG_LEG_LIGHT_TYPE + final_color = vec3(0,0.5,0); + #endif } if (spec.a > 0.0) @@ -278,6 +284,12 @@ void main() #if DEBUG_SPOT_NL final_color = vec3(nl); #endif +#if DEBUG_SPOT_ZERO + final_color = vec3(0,0,0); +#endif +#if DEBUG_ANY_LIGHT_TYPE + final_color = vec3(0,0.3333,0); +#endif //not sure why, but this line prevents MATBUG-194 final_color = max(final_color, vec3(0.0)); |