From 98eeeba24bde1d22ea4f388fc640dae427681309 Mon Sep 17 00:00:00 2001 From: KINDNICK <68893236+KINDNICK@users.noreply.github.com> Date: Wed, 17 Dec 2025 00:03:52 +0900 Subject: [PATCH] =?UTF-8?q?Fix=20:=20=EB=8B=90=EB=A1=9C=ED=88=B0=20?= =?UTF-8?q?=ED=8D=BC=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=ED=98=B8?= =?UTF-8?q?=ED=99=98=EC=84=B1=20=EC=B6=94=EA=B0=80=20=ED=8C=A8=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Shaders/NiloToonCharacterFur.shader | 25 +++++++++++++++++-- .../NiloToonCharacterFur_Fragment.hlsl | 10 +++----- .../NiloToonCharacterFur_Shared.hlsl | 4 +-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Assets/NiloToonURP/Shaders/NiloToonCharacterFur.shader b/Assets/NiloToonURP/Shaders/NiloToonCharacterFur.shader index d36cc085..c46f7c50 100644 --- a/Assets/NiloToonURP/Shaders/NiloToonCharacterFur.shader +++ b/Assets/NiloToonURP/Shaders/NiloToonCharacterFur.shader @@ -158,8 +158,8 @@ Shader "Universal Render Pipeline/NiloToon/NiloToon_Character_Fur" ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [HideInInspector] _PerCharacterBaseColorMultiply("_PerCharacterBaseColorMultiply", Float) = 1 [HideInInspector] _PerCharacterBaseColorTint("_PerCharacterBaseColorTint", Color) = (1, 1, 1, 1) - [HideInInspector] _PerCharacterTintColor("_PerCharacterTintColor", Color) = (1, 1, 1, 1) - [HideInInspector] _PerCharacterAddColor("_PerCharacterAddColor", Color) = (0, 0, 0, 0) + [HideInInspector] _PerCharEffectTintColor("_PerCharEffectTintColor", Color) = (1, 1, 1, 1) + [HideInInspector] _PerCharEffectAddColor("_PerCharEffectAddColor", Color) = (0, 0, 0, 0) [HideInInspector] _PerCharEffectDesaturatePercentage("_PerCharEffectDesaturatePercentage", Range(0,1)) = 0 [HideInInspector] _PerCharEffectLerpColor("_PerCharEffectLerpColor", Color) = (1, 1, 0, 0) @@ -551,6 +551,11 @@ Shader "Universal Render Pipeline/NiloToon/NiloToon_Character_Fur" half alpha = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv).a * _BaseColor.a; clip(alpha - _Cutoff); + // Apply dither fadeout to shadow casting (must come before dissolve) + #if _NILOTOON_DITHER_FADEOUT + NiloDoDitherFadeoutClip(input.positionCS.xy, 1.0 - _DitherFadeoutAmount * _AllowPerCharacterDitherFadeout); + #endif + // Apply dissolve to shadow casting #if _NILOTOON_DISSOLVE half3 dummyColor = half3(1, 1, 1); @@ -624,6 +629,11 @@ Shader "Universal Render Pipeline/NiloToon/NiloToon_Character_Fur" half alpha = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv).a * _BaseColor.a; clip(alpha - _Cutoff); + // Apply dither fadeout to depth (must come before dissolve) + #if _NILOTOON_DITHER_FADEOUT + NiloDoDitherFadeoutClip(input.positionCS.xy, 1.0 - _DitherFadeoutAmount * _AllowPerCharacterDitherFadeout); + #endif + // Apply dissolve to depth #if _NILOTOON_DISSOLVE half3 dummyColor = half3(1, 1, 1); @@ -697,6 +707,12 @@ Shader "Universal Render Pipeline/NiloToon/NiloToon_Character_Fur" half alpha = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv).a * _BaseColor.a; clip(alpha - _Cutoff); + // Apply dither fadeout to depth normals (must come before dissolve) + // This is critical for HBAO/SSAO - without this, AO will render on dithered areas + #if _NILOTOON_DITHER_FADEOUT + NiloDoDitherFadeoutClip(input.positionCS.xy, 1.0 - _DitherFadeoutAmount * _AllowPerCharacterDitherFadeout); + #endif + // Apply dissolve to depth normals #if _NILOTOON_DISSOLVE half3 dummyColor = half3(1, 1, 1); @@ -777,6 +793,11 @@ Shader "Universal Render Pipeline/NiloToon/NiloToon_Character_Fur" half alpha = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv).a * _BaseColor.a; clip(alpha - _Cutoff); + // Apply dither fadeout to prepass buffer (must come before dissolve) + #if _NILOTOON_DITHER_FADEOUT + NiloDoDitherFadeoutClip(input.positionCS.xy, 1.0 - _DitherFadeoutAmount * _AllowPerCharacterDitherFadeout); + #endif + // Apply dissolve to prepass buffer #if _NILOTOON_DISSOLVE half3 dummyColor = half3(1, 1, 1); diff --git a/Assets/NiloToonURP/Shaders/NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Fragment.hlsl b/Assets/NiloToonURP/Shaders/NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Fragment.hlsl index 2ebfe2ee..c1b8a755 100644 --- a/Assets/NiloToonURP/Shaders/NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Fragment.hlsl +++ b/Assets/NiloToonURP/Shaders/NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Fragment.hlsl @@ -143,17 +143,13 @@ half3 ApplyPerCharacterColorControls(half3 color) color *= _PerCharacterBaseColorMultiply; color *= _PerCharacterBaseColorTint.rgb; - // Tint Color - color *= _PerCharacterTintColor.rgb; - - // Add Color - color += _PerCharacterAddColor.rgb; + // Per-Character Tint & Add Color (set by NiloToonPerCharacterRenderController) + // Matching NiloToonCharacter_Shared.hlsl: color.rgb = color.rgb * _PerCharEffectTintColor + _PerCharEffectAddColor; + color.rgb = color.rgb * _PerCharEffectTintColor + _PerCharEffectAddColor; // Desaturation (matching NiloToonCharacter_Shared.hlsl line 4099) color = lerp(color, Luminance(color), _PerCharEffectDesaturatePercentage); - // Mul Add (already handled above with _PerCharacterTintColor and _PerCharacterAddColor) - // Replace by Color / Lerp Color (matching NiloToonCharacter_Shared.hlsl line 4105) // Uses alpha channel of _PerCharEffectLerpColor as the lerp amount color.rgb = lerp(color.rgb, _PerCharEffectLerpColor.rgb, _PerCharEffectLerpColor.a); diff --git a/Assets/NiloToonURP/Shaders/NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Shared.hlsl b/Assets/NiloToonURP/Shaders/NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Shared.hlsl index 5f0fe867..4c10c322 100644 --- a/Assets/NiloToonURP/Shaders/NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Shared.hlsl +++ b/Assets/NiloToonURP/Shaders/NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Shared.hlsl @@ -149,8 +149,8 @@ CBUFFER_START(UnityPerMaterial) // Per-Character Color Controls half _PerCharacterBaseColorMultiply; half4 _PerCharacterBaseColorTint; - half4 _PerCharacterTintColor; - half4 _PerCharacterAddColor; + half3 _PerCharEffectTintColor; // Set by NiloToonPerCharacterRenderController + half3 _PerCharEffectAddColor; // Set by NiloToonPerCharacterRenderController half _PerCharEffectDesaturatePercentage; half4 _PerCharEffectLerpColor;