From 3ec0f0c2d35f21d2f28d0a116e9e211789b13903 Mon Sep 17 00:00:00 2001 From: yum Date: Sat, 22 Feb 2025 17:25:23 -0800 Subject: add ssfd --- 2ner.cginc | 13 +++++++++++++ 2ner.shader | 17 +++++++++++++++++ Scripts/Editor/GenerateMetallicGlossMap.cs | 4 ++++ features.cginc | 4 ++++ globals.cginc | 8 ++++++++ 5 files changed, 46 insertions(+) diff --git a/2ner.cginc b/2ner.cginc index 18deaf3..f1cd356 100644 --- a/2ner.cginc +++ b/2ner.cginc @@ -10,6 +10,7 @@ #include "interpolators.cginc" #include "matcaps.cginc" #include "poi.cginc" +#include "ssfd.cginc" #include "yum_brdf.cginc" #include "yum_pbr.cginc" #include "yum_lighting.cginc" @@ -92,6 +93,18 @@ float4 frag(v2f i) : SV_Target { YumPbr pbr = GetYumPbr(i); +#if defined(_SSFD) + float ssfd_mask = ssfd(i.uv01.xy, _SSFD_Scale, _SSFD_Max_Fwidth, 0, _SSFD_Noise); + pbr.albedo *= (ssfd_mask > _SSFD_Threshold); +#endif + +#if defined(OUTLINE_PASS) + pbr.smoothness = 0; + pbr.roughness = 1; + pbr.roughness_perceptual = 1; + pbr.metallic = 0; +#endif + #if defined(_EYE_EFFECT_00) pbr.normal = eye_effect_00.normal; #endif diff --git a/2ner.shader b/2ner.shader index 9ef319c..2ae477c 100644 --- a/2ner.shader +++ b/2ner.shader @@ -251,6 +251,17 @@ Shader "yum_food/2ner" [HideInInspector] m_end_Eye_Effect_00("Eye effect 00", Float) = 0 //endex + //ifex _SSFD_Enabled==0 + [HideInInspector] m_start_SSFD("SSFD", Float) = 0 + [ThryToggle(_SSFD)] _SSFD_Enabled("Enable", Float) = 0 + _SSFD_Scale("Scale", Float) = 1.0 + _SSFD_Max_Fwidth("Max fwidth", Float) = 1.0 + _SSFD_Noise("Noise", 3D) = "black" {} + _SSFD_Size_Factor("Size factor", Float) = 1.0 + _SSFD_Threshold("Threshold", Range(0, 1)) = 0.5 + [HideInInspector] m_end_SSFD("SSFD", Float) = 0 + //endex + [HideInInspector] m_lightingOptions("Lighting Options", Float) = 0 //ifex _Receive_Shadows_Enabled==0 [HideInInspector] m_start_Shadow_Receiving("Receive shadows", Float) = 0 @@ -287,6 +298,12 @@ Shader "yum_food/2ner" _Quantize_Specular_Steps("Steps", Float) = 1 [HideInInspector] m_end_Quantize_Specular("Quantize Specular", Float) = 0 //endex + //ifex _LTCGI_Enabled==0 + [HideInInspector] m_start_LTCGI("LTCGI", Float) = 0 + [ThryToggle(_LTCGI)] _LTCGI_Enabled("Enable", Float) = 0 + _LTCGI_Strength("Strength", Range(0, 1)) = 1.0 + [HideInInspector] m_end_LTCGI("LTCGI", Float) = 0 + //endex [HideInInspector] m_renderingOptions("Rendering Options", Float) = 0 [Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull", Float) = 2 diff --git a/Scripts/Editor/GenerateMetallicGlossMap.cs b/Scripts/Editor/GenerateMetallicGlossMap.cs index 78f54cf..b32c245 100644 --- a/Scripts/Editor/GenerateMetallicGlossMap.cs +++ b/Scripts/Editor/GenerateMetallicGlossMap.cs @@ -1,3 +1,5 @@ +#if UNITY_EDITOR + using UnityEngine; using UnityEditor; using System.IO; @@ -92,3 +94,5 @@ public class GenerateMetallicGlossMap : EditorWindow Debug.Log("Generated metallic gloss map at: " + newPath); } } + +#endif // UNITY_EDITOR diff --git a/features.cginc b/features.cginc index e42a768..7f1cccc 100644 --- a/features.cginc +++ b/features.cginc @@ -75,5 +75,9 @@ #pragma shader_feature_local _EYE_EFFECT_00 //endex +//ifex _SSFD_Enabled==0 +#pragma shader_feature_local _SSFD +//endex + #endif // __FEATURES_INC diff --git a/globals.cginc b/globals.cginc index 50859c4..2ba3ad0 100644 --- a/globals.cginc +++ b/globals.cginc @@ -182,4 +182,12 @@ float _Gimmick_Eye_Effect_00_Domain_Warping_Speed; float _Gimmick_Eye_Effect_00_Domain_Warping_Strength; #endif // _EYE_EFFECT_00 +#if defined(_SSFD) +float _SSFD_Scale; +float _SSFD_Max_Fwidth; +texture3D _SSFD_Noise; +float _SSFD_Size_Factor; +float _SSFD_Threshold; +#endif // _SSFD + #endif // __GLOBALS_INC -- cgit v1.2.3