From 2640168f2d7d838325aa319ebb0aa7d55de10608 Mon Sep 17 00:00:00 2001 From: yum Date: Thu, 26 Mar 2026 17:31:47 -0700 Subject: Put ssfd shadow effect behind static branch --- 3ner.shader | 6 ++++++ features.cginc | 1 + globals.cginc | 4 ++++ ssfd.cginc | 5 +++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/3ner.shader b/3ner.shader index 3435c1f..0398d27 100755 --- a/3ner.shader +++ b/3ner.shader @@ -1081,6 +1081,12 @@ Shader "yum_food/3ner" _SSFD_Noise("Noise", 3D) = "black" {} _SSFD_Size_Factor("Size factor", Float) = 1.0 _SSFD_Threshold("Threshold", Range(0, 1)) = 0.5 + //ifex _SSFD_Shadow_Enabled==0 + [HideInInspector] m_start_SSFD_Shadow("Shadow", Float) = 0 + [ThryToggle(_SSFD_SHADOW)] _SSFD_Shadow_Enabled("Enable", Float) = 0 + _SSFD_Shadow_Amount("Amount", Range(0, 1)) = 1.0 + [HideInInspector] m_end_SSFD_Shadow("Shadow", Float) = 0 + //endex [HideInInspector] m_end_SSFD("SSFD", Float) = 0 //endex diff --git a/features.cginc b/features.cginc index 726383e..1ea3858 100755 --- a/features.cginc +++ b/features.cginc @@ -228,6 +228,7 @@ //ifex _SSFD_Enabled==0 #pragma shader_feature_local _SSFD +#pragma shader_feature_local _SSFD_SHADOW //endex //ifex _Letter_Grid_Enabled==0 diff --git a/globals.cginc b/globals.cginc index ef26ca7..d7ac640 100755 --- a/globals.cginc +++ b/globals.cginc @@ -573,6 +573,10 @@ float _SSFD_Size_Factor; float _SSFD_Threshold; #endif // _SSFD +#if defined(_SSFD_SHADOW) +float _SSFD_Shadow_Amount; +#endif // _SSFD_SHADOW + #if defined(_CLOTH) float4 _Cloth_Sheen; #endif // _CLOTH diff --git a/ssfd.cginc b/ssfd.cginc index 5d385c6..c3e1c89 100644 --- a/ssfd.cginc +++ b/ssfd.cginc @@ -59,10 +59,11 @@ void apply_ssfd(v2f i, float2 uv, LightData l, float3 normal, inout float3 albed float ssfd_mask = ssfd(uv, _SSFD_Scale, _SSFD_Max_Fwidth, 0, _SSFD_Noise); float ssfd_mask_fw = fwidth(ssfd_mask); // TODO I think anti aliasing is probably broken - float light_amount = 1.0 - (dot(l.indirect.diffuse_dominant_dir, normal) * 0.5 + 0.5); + //float light_amount = 1.0 - (dot(l.indirect.diffuse_dominant_dir, normal) * 0.5 + 0.5); + float light_amount = 0; float ssfd_threshold = saturate(light_amount + _SSFD_Threshold); ssfd_mask = smoothstep(ssfd_threshold - ssfd_mask_fw * 0.5, ssfd_threshold + ssfd_mask_fw * 0.5, ssfd_mask); - albedo += ssfd_mask * _SSFD_Tint.rgb; + albedo = lerp(albedo, _SSFD_Tint.rgb, ssfd_mask); #endif } -- cgit v1.2.3