diff options
| -rwxr-xr-x | 3ner.shader | 1 | ||||
| -rwxr-xr-x | Scripts/gaussianize (renamed from Scripts/gaussianize.py) | 0 | ||||
| -rw-r--r-- | data.cginc | 3 | ||||
| -rw-r--r-- | debug.cginc | 2 | ||||
| -rwxr-xr-x | features.cginc | 1 | ||||
| -rwxr-xr-x | pbr.cginc | 5 |
6 files changed, 12 insertions, 0 deletions
diff --git a/3ner.shader b/3ner.shader index 5cc10be..b656b26 100755 --- a/3ner.shader +++ b/3ner.shader @@ -1146,6 +1146,7 @@ Shader "yum_food/3ner" [HideInInspector] m_start_Debug_Views("Debug Views", Float) = 0 [ThryToggle(_DEBUG_VIEW_UNLIT)] _Debug_View_Unlit("Unlit", Float) = 0 + [ThryToggle(_DEBUG_VIEW_TANGENT_SPACE_NORMALS)] _Debug_View_Tangent_Space_Normals("Tangent space normals", Float) = 0 [ThryToggle(_DEBUG_VIEW_WORLD_SPACE_NORMALS)] _Debug_View_World_Space_Normals("World space normals", Float) = 0 [ThryToggle(_DEBUG_VIEW_OBJECT_SPACE_NORMALS)] _Debug_View_Object_Space_Normals("Object space normals", Float) = 0 [ThryToggle(_DEBUG_VIEW_METALLIC_GLOSS)] _Debug_View_Metallic_Gloss("Metallic gloss", Float) = 0 diff --git a/Scripts/gaussianize.py b/Scripts/gaussianize index 2ca915d..2ca915d 100755 --- a/Scripts/gaussianize.py +++ b/Scripts/gaussianize @@ -31,6 +31,9 @@ struct Pbr { float cc_roughness_perceptual; float cc_strength; #endif +#if defined(_DEBUG_VIEW_TANGENT_SPACE_NORMALS) + float3 tangent_normal; +#endif }; struct LightCommon { diff --git a/debug.cginc b/debug.cginc index 2103a50..6510fdd 100644 --- a/debug.cginc +++ b/debug.cginc @@ -5,6 +5,8 @@ float4 apply_debug_view(v2f i, Pbr pbr, LightData light_data, BrdfData bd, float4 color) { #if defined(_DEBUG_VIEW_UNLIT) return pbr.albedo; +#elif defined(_DEBUG_VIEW_TANGENT_SPACE_NORMALS) + return float4((pbr.tangent_normal + 1.0f) * 0.5f, 1); #elif defined(_DEBUG_VIEW_WORLD_SPACE_NORMALS) return float4((pbr.normal + 1.0f) * 0.5f, 1); #elif defined(_DEBUG_VIEW_OBJECT_SPACE_NORMALS) diff --git a/features.cginc b/features.cginc index 42202ff..09a2c30 100755 --- a/features.cginc +++ b/features.cginc @@ -78,6 +78,7 @@ //endex #pragma shader_feature_local _DEBUG_VIEW_UNLIT +#pragma shader_feature_local _DEBUG_VIEW_TANGENT_SPACE_NORMALS #pragma shader_feature_local _DEBUG_VIEW_WORLD_SPACE_NORMALS #pragma shader_feature_local _DEBUG_VIEW_OBJECT_SPACE_NORMALS #pragma shader_feature_local _DEBUG_VIEW_METALLIC_GLOSS @@ -42,6 +42,7 @@ float2 parallax_offset(float2 uv, float3 view_dir_world, float3x3 tbn) { float prev_depth = cur_depth; float prev_height = cur_height; + [loop] for (int i = 0; i < (int)step_count; i++) { bool was_inside = cur_depth < cur_height; if (was_inside != inside) break; @@ -401,6 +402,10 @@ Pbr getPbr(v2f i) { pbr.normal = normalize(mul(normal_tangent, pbr.tbn)); +#if defined(_DEBUG_VIEW_TANGENT_SPACE_NORMALS) + pbr.tangent_normal = normal_tangent; +#endif + #if defined(_BENT_NORMALS) float3 bent_ts = UnpackNormal(_Bent_Normals_Map.Sample( aniso4_trilinear_repeat_s, uv_parallax * _Bent_Normals_Map_ST.xy + |
