diff options
Diffstat (limited to '3ner.cginc')
| -rwxr-xr-x | 3ner.cginc | 29 |
1 files changed, 5 insertions, 24 deletions
@@ -9,6 +9,7 @@ #include "AutoLight.cginc" #include "brdf.cginc" +#include "debug.cginc" #include "cnlohr.cginc" #include "geometry.cginc" #include "pbr.cginc" @@ -301,6 +302,7 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace #endif // Convert normal and tangent to world space. + // `UnityObjectToWorldNormal` normalizes its output. i.normal = UnityObjectToWorldNormal(i.normal); i.tangent.xyz = UnityObjectToWorldNormal(i.tangent.xyz); @@ -312,34 +314,13 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace clip(pbr.albedo.a - 0.5); } -#if defined(_DEBUG_VIEW_UNLIT) - return pbr.albedo; -#elif defined(_DEBUG_VIEW_WORLD_SPACE_NORMALS) - return float4((pbr.normal + 1.0f) * 0.5f, 1); -#elif defined(_DEBUG_VIEW_OBJECT_SPACE_NORMALS) - float3 normalOS = normalize(mul((float3x3)unity_WorldToObject, pbr.normal)); - return float4((normalOS + 1.0f) * 0.5f, 1); -#elif defined(_DEBUG_VIEW_METALLIC_GLOSS) - return float4(pbr.metallic, pbr.smoothness, 0, 1); -#elif defined(_DEBUG_VIEW_DEPTH) - float2 screen_uv = i.pos.xy / _ScreenParams.xy; - float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, screen_uv); - depth *= 100; - depth *= depth; - depth *= depth; - depth *= 100; - return float4(depth, depth, depth, 1); -#endif - LightData light_data; GetLighting(i, pbr, light_data); applyMatcapsAndRimLighting(i, pbr, light_data); -#if 0 - float c = light_data.common.NoV; - return float4(c,c,c,1); -#endif - return brdf(pbr, light_data); + BrdfData bd; + float4 lit = brdf(pbr, light_data, bd); + return apply_debug_view(i, pbr, light_data, bd, lit); } #endif // __3NER_INC |
