diff --git a/com.unity.toonshader/Editor/UTS3GUI.cs b/com.unity.toonshader/Editor/UTS3GUI.cs index edf27abfe..cd895338f 100644 --- a/com.unity.toonshader/Editor/UTS3GUI.cs +++ b/com.unity.toonshader/Editor/UTS3GUI.cs @@ -79,7 +79,6 @@ internal void FindTessellationProperties(MaterialProperty[] props) { internal const string ShaderDefineSHADINGGRADEMAP = "_SHADINGGRADEMAP"; internal const string ShaderDefineANGELRING_ON = "_IS_ANGELRING_ON"; internal const string ShaderDefineANGELRING_OFF = "_IS_ANGELRING_OFF"; - internal const string ShaderDefineUTS_USE_RAYTRACING_SHADOW = "UTS_USE_RAYTRACING_SHADOW"; internal const string ShaderPropAngelRing = "_AngelRing"; internal const string ShaderPropMatCap = "_MatCap"; internal const string ShaderPropMainTex = "_MainTex"; diff --git a/com.unity.toonshader/Runtime/HDRP/Shaders/ShaderPassForwardUTS.hlsl b/com.unity.toonshader/Runtime/HDRP/Shaders/ShaderPassForwardUTS.hlsl index 863fd02bd..ea858841b 100644 --- a/com.unity.toonshader/Runtime/HDRP/Shaders/ShaderPassForwardUTS.hlsl +++ b/com.unity.toonshader/Runtime/HDRP/Shaders/ShaderPassForwardUTS.hlsl @@ -263,7 +263,7 @@ void Frag(PackedVaryingsToPS packedInput, if (_DirectionalShadowIndex >= 0) { DirectionalLightData light = _DirectionalLightDatas[_DirectionalShadowIndex]; -#if defined(SCREEN_SPACE_SHADOWS_ON) && !defined(_SURFACE_TYPE_TRANSPARENT) && !defined(UTS_USE_RAYTRACING_SHADOW) +#if defined(SCREEN_SPACE_SHADOWS_ON) && !defined(_SURFACE_TYPE_TRANSPARENT) if (UtsUseScreenSpaceShadow(light, bsdfData.normalWS)) { // HDRP Contact Shadow @@ -281,42 +281,15 @@ void Frag(PackedVaryingsToPS packedInput, !ShouldEvaluateThickObjectTransmission(V, L, preLightData, bsdfData, light.shadowIndex)) { -#if defined(UTS_USE_RAYTRACING_SHADOW) - { - /* - struct PositionInputs - { - float3 positionWS; // World space position (could be camera-relative) - float2 positionNDC; // Normalized screen coordinates within the viewport : [0, 1) (with the half-pixel offset) - uint2 positionSS; // Screen space pixel coordinates : [0, NumPixels) - uint2 tileCoord; // Screen tile coordinates : [0, NumTiles) - float deviceDepth; // Depth from the depth buffer : [0, 1] (typically reversed) - float linearDepth; // View space Z coordinate : [Near, Far] - }; - float4 size = _RaytracedHardShadow_TexelSize; - */ - - float r = UNITY_SAMPLE_SCREEN_SHADOW(_RaytracedHardShadow, float4(posInput.positionNDC.xy, 0.0, 1)); - context.shadowValue = r; - } -#else { context.shadowValue = GetDirectionalShadowAttenuation(context.shadowContext, posInput.positionSS, posInput.positionWS, GetNormalForShadowBias(bsdfData), light.shadowIndex, L); } -#endif // UTS_USE_RAYTRACING_SHADOW } -#if defined (UTS_USE_RAYTRACING_SHADOW) - else - { - float r = UNITY_SAMPLE_SCREEN_SHADOW(_RaytracedHardShadow, float4(posInput.positionNDC.xy, 0.0, 1)); - context.shadowValue = r; - } -#endif // UTS_USE_RAYTRACING_SHADOW } } diff --git a/com.unity.toonshader/Runtime/HDRP/Shaders/ShadingGrademapMainLight.hlsl b/com.unity.toonshader/Runtime/HDRP/Shaders/ShadingGrademapMainLight.hlsl index e0204fa66..2fbd7871e 100644 --- a/com.unity.toonshader/Runtime/HDRP/Shaders/ShadingGrademapMainLight.hlsl +++ b/com.unity.toonshader/Runtime/HDRP/Shaders/ShadingGrademapMainLight.hlsl @@ -120,11 +120,10 @@ float3 UTS_MainLightShadingGrademap(LightLoopContext lightLoopContext, FragInput //v.2.0.6 float4 _ShadingGradeMap_var = tex2Dlod(_ShadingGradeMap, float4(TRANSFORM_TEX(Set_UV0, _ShadingGradeMap), 0.0, _BlurLevelSGM)); //v.2.0.6 - //Minmimum value is same as the Minimum Feather's value with the Minimum Step's value as threshold. -#if !defined (UTS_USE_RAYTRACING_SHADOW) + //Minimum value is same as the Minimum Feather's value with the Minimum Step's value as threshold. shadowAttenuation *= 2.0f; shadowAttenuation = saturate(shadowAttenuation); -#endif + float _SystemShadowsLevel_var = (shadowAttenuation *0.5)+0.5+_Tweak_SystemShadowsLevel > 0.001 ? (shadowAttenuation*0.5)+0.5+_Tweak_SystemShadowsLevel : 0.0001; float _ShadingGradeMapLevel_var = _ShadingGradeMap_var.r < 0.95 ? _ShadingGradeMap_var.r + _Tweak_ShadingGradeMapLevel : 1; diff --git a/com.unity.toonshader/Runtime/Integrated/Shaders/UnityToon.shader b/com.unity.toonshader/Runtime/Integrated/Shaders/UnityToon.shader index 70c3ba8fd..d3611ba15 100644 --- a/com.unity.toonshader/Runtime/Integrated/Shaders/UnityToon.shader +++ b/com.unity.toonshader/Runtime/Integrated/Shaders/UnityToon.shader @@ -1,4 +1,4 @@ -//Auto-generated on Fri Nov 07 05:27:25 UTC 2025 +//Auto-generated on Tue Nov 18 11:05:20 UTC 2025 Shader "Toon" { Properties { @@ -1044,8 +1044,6 @@ Shader "Toon" { // used in ShadingGradeMap #pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON #pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON - // used in Shadow calculation - #pragma shader_feature_local _ UTS_USE_RAYTRACING_SHADOW // used in DoubleShadeWithFeather #pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE // controlling mask rendering @@ -1295,8 +1293,6 @@ Shader "Toon" { #pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON #pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON - // used in Shadow calculation - #pragma shader_feature_local _ UTS_USE_RAYTRACING_SHADOW // used in DoubleShadeWithFeather #pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE @@ -1562,8 +1558,6 @@ Shader "Toon" { #pragma shader_feature _EMISSIVE_SIMPLE _EMISSIVE_ANIMATION #pragma multi_compile _IS_PASS_FWDBASE - // - #pragma shader_feature_local UTS_USE_RAYTRACING_SHADOW #if defined(_SHADINGGRADEMAP) #include "../../Legacy/Shaders/UCTS_ShadingGradeMap.cginc" @@ -1647,7 +1641,6 @@ Shader "Toon" { //v.2.0.4 #pragma multi_compile _IS_PASS_FWDDELTA - #pragma shader_feature_local UTS_USE_RAYTRACING_SHADOW #if defined(_SHADINGGRADEMAP) diff --git a/com.unity.toonshader/Runtime/Integrated/Shaders/UnityToonTessellation.shader b/com.unity.toonshader/Runtime/Integrated/Shaders/UnityToonTessellation.shader index 9bdd60be2..150db97d4 100644 --- a/com.unity.toonshader/Runtime/Integrated/Shaders/UnityToonTessellation.shader +++ b/com.unity.toonshader/Runtime/Integrated/Shaders/UnityToonTessellation.shader @@ -1,4 +1,4 @@ -//Auto-generated on Fri Nov 07 05:27:25 UTC 2025 +//Auto-generated on Tue Nov 18 11:05:20 UTC 2025 Shader "Toon(Tessellation)" { Properties { @@ -1081,8 +1081,6 @@ Shader "Toon(Tessellation)" { // used in ShadingGradeMap #pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON #pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON - // used in Shadow calculation - #pragma shader_feature_local _ UTS_USE_RAYTRACING_SHADOW // used in DoubleShadeWithFeather #pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE // controlling mask rendering @@ -1332,8 +1330,6 @@ Shader "Toon(Tessellation)" { #pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON #pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON - // used in Shadow calculation - #pragma shader_feature_local _ UTS_USE_RAYTRACING_SHADOW // used in DoubleShadeWithFeather #pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE @@ -1640,8 +1636,6 @@ Shader "Toon(Tessellation)" { #pragma shader_feature _EMISSIVE_SIMPLE _EMISSIVE_ANIMATION #pragma multi_compile _IS_PASS_FWDBASE - // - #pragma shader_feature_local UTS_USE_RAYTRACING_SHADOW #if defined(_SHADINGGRADEMAP) #include "../../Legacy/Shaders/UCTS_ShadingGradeMap.cginc" @@ -1737,7 +1731,6 @@ Shader "Toon(Tessellation)" { //v.2.0.4 #pragma multi_compile _IS_PASS_FWDDELTA - #pragma shader_feature_local UTS_USE_RAYTRACING_SHADOW #if defined(_SHADINGGRADEMAP) diff --git a/com.unity.toonshader/Runtime/Legacy/Shaders/UCTS_Light.cginc b/com.unity.toonshader/Runtime/Legacy/Shaders/UCTS_Light.cginc index 1a9dff8fa..39e0596d5 100644 --- a/com.unity.toonshader/Runtime/Legacy/Shaders/UCTS_Light.cginc +++ b/com.unity.toonshader/Runtime/Legacy/Shaders/UCTS_Light.cginc @@ -4,40 +4,7 @@ #define __UCTS_LIGHT__ #include "AutoLight.cginc" - -#if defined(UTS_USE_RAYTRACING_SHADOW) - #define UTS_LIGHT_ATTENUATION(destName, input, worldPos) fixed destName = UtsLightAttenuation(input, worldPos) - - uniform sampler2D _RaytracedHardShadow; - fixed rths_shadowAttenuation(float2 lightmapUV, float3 worldPos, float4 screenPos) { - -//Handle division by zero warning, based on how UNITY_SHADOW_ATTENUATION is used in Autolight.cginc -#if (!defined(HANDLE_SHADOWS_BLENDING_IN_GI)) \ - && !(defined(SHADOWS_SCREEN) && !defined(LIGHTMAP_ON) && !defined(UNITY_NO_SCREENSPACE_SHADOWS)) \ - && !(defined(SHADOWS_SHADOWMASK)) \ - && !(defined(SHADOWS_DEPTH) || defined(SHADOWS_SCREEN) || defined(SHADOWS_CUBE)) \ - && (UNITY_LIGHT_PROBE_PROXY_VOLUME) - float r = UNITY_SAMPLE_SCREEN_SHADOW(_RaytracedHardShadow, float4(screenPos.xyz,1)).r; -#else - float r = UNITY_SAMPLE_SCREEN_SHADOW(_RaytracedHardShadow, screenPos).r; -#endif //end handling division by zero - - return r; - } - -//--------------------------------------------------------------------------------------------------------------------- - - fixed UtsLightAttenuation(VertexOutput input, float3 worldPos) { - //redefine UnityComputeForwardShadows inside UNITY_LIGHT_ATTENUATION - #define UnityComputeForwardShadows(v0,v1,v2) rths_shadowAttenuation(v0,v1,v2) - UNITY_LIGHT_ATTENUATION(attenuation, input, worldPos); - #undef UnityComputeForwardShadows - return attenuation; - } -#else - // original - #define UTS_LIGHT_ATTENUATION(destName, input, worldPos) UNITY_LIGHT_ATTENUATION(destName, input, worldPos) -#endif //UTS_USE_RAYTRACING_SHADOW +#define UTS_LIGHT_ATTENUATION(destName, input, worldPos) UNITY_LIGHT_ATTENUATION(destName, input, worldPos) #endif //__UCTS_LIGHT__ diff --git a/com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToon.shadertemplate b/com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToon.shadertemplate index dbbcfd493..6605e6c15 100644 --- a/com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToon.shadertemplate +++ b/com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToon.shadertemplate @@ -556,8 +556,6 @@ Shader "Toon" { // used in ShadingGradeMap #pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON #pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON - // used in Shadow calculation - #pragma shader_feature_local _ UTS_USE_RAYTRACING_SHADOW // used in DoubleShadeWithFeather #pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE // controlling mask rendering @@ -807,8 +805,6 @@ Shader "Toon" { #pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON #pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON - // used in Shadow calculation - #pragma shader_feature_local _ UTS_USE_RAYTRACING_SHADOW // used in DoubleShadeWithFeather #pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE @@ -1074,8 +1070,6 @@ Shader "Toon" { #pragma shader_feature _EMISSIVE_SIMPLE _EMISSIVE_ANIMATION #pragma multi_compile _IS_PASS_FWDBASE - // - #pragma shader_feature_local UTS_USE_RAYTRACING_SHADOW #if defined(_SHADINGGRADEMAP) #include "../../Legacy/Shaders/UCTS_ShadingGradeMap.cginc" @@ -1159,7 +1153,6 @@ Shader "Toon" { //v.2.0.4 #pragma multi_compile _IS_PASS_FWDDELTA - #pragma shader_feature_local UTS_USE_RAYTRACING_SHADOW #if defined(_SHADINGGRADEMAP) diff --git a/com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToonTessellation.shadertemplate b/com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToonTessellation.shadertemplate index 83b49c5e3..98d010c25 100644 --- a/com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToonTessellation.shadertemplate +++ b/com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToonTessellation.shadertemplate @@ -577,8 +577,6 @@ Shader "Toon(Tessellation)" { // used in ShadingGradeMap #pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON #pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON - // used in Shadow calculation - #pragma shader_feature_local _ UTS_USE_RAYTRACING_SHADOW // used in DoubleShadeWithFeather #pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE // controlling mask rendering @@ -828,8 +826,6 @@ Shader "Toon(Tessellation)" { #pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON #pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON - // used in Shadow calculation - #pragma shader_feature_local _ UTS_USE_RAYTRACING_SHADOW // used in DoubleShadeWithFeather #pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE @@ -1136,8 +1132,6 @@ Shader "Toon(Tessellation)" { #pragma shader_feature _EMISSIVE_SIMPLE _EMISSIVE_ANIMATION #pragma multi_compile _IS_PASS_FWDBASE - // - #pragma shader_feature_local UTS_USE_RAYTRACING_SHADOW #if defined(_SHADINGGRADEMAP) #include "../../Legacy/Shaders/UCTS_ShadingGradeMap.cginc" @@ -1233,7 +1227,6 @@ Shader "Toon(Tessellation)" { //v.2.0.4 #pragma multi_compile _IS_PASS_FWDDELTA - #pragma shader_feature_local UTS_USE_RAYTRACING_SHADOW #if defined(_SHADINGGRADEMAP) diff --git a/com.unity.toonshader/Runtime/UniversalRP/Shaders/UniversalToonBody.hlsl b/com.unity.toonshader/Runtime/UniversalRP/Shaders/UniversalToonBody.hlsl index 3743491c8..7e58fda69 100644 --- a/com.unity.toonshader/Runtime/UniversalRP/Shaders/UniversalToonBody.hlsl +++ b/com.unity.toonshader/Runtime/UniversalRP/Shaders/UniversalToonBody.hlsl @@ -252,11 +252,7 @@ #endif ShadowSamplingData shadowSamplingData = GetMainLightShadowSamplingData(); half4 shadowParams = GetMainLightShadowParams(); -#if defined(UTS_USE_RAYTRACING_SHADOW) - float w = (positionCS.w == 0) ? 0.00001 : positionCS.w; - float4 screenPos = ComputeScreenPos(positionCS / w); - return SAMPLE_TEXTURE2D(_RaytracedHardShadow, sampler_RaytracedHardShadow, screenPos); -#elif defined(_MAIN_LIGHT_SHADOWS_SCREEN) +#if defined(_MAIN_LIGHT_SHADOWS_SCREEN) return SampleScreenSpaceShadowmap(shadowCoord); #endif @@ -266,11 +262,6 @@ half AdditionalLightRealtimeShadowUTS(int lightIndex, float3 positionWS, float4 positionCS) { -#if defined(UTS_USE_RAYTRACING_SHADOW) - float w = (positionCS.w == 0) ? 0.00001 : positionCS.w; - float4 screenPos = ComputeScreenPos(positionCS / w); - return SAMPLE_TEXTURE2D(_RaytracedHardShadow, sampler_RaytracedHardShadow, screenPos); -#endif // UTS_USE_RAYTRACING_SHADOW #if defined(ADDITIONAL_LIGHT_CALCULATE_SHADOWS) diff --git a/com.unity.toonshader/Runtime/UniversalRP/Shaders/UniversalToonBodyShadingGradeMap.hlsl b/com.unity.toonshader/Runtime/UniversalRP/Shaders/UniversalToonBodyShadingGradeMap.hlsl index 30253c083..f5df3555d 100644 --- a/com.unity.toonshader/Runtime/UniversalRP/Shaders/UniversalToonBodyShadingGradeMap.hlsl +++ b/com.unity.toonshader/Runtime/UniversalRP/Shaders/UniversalToonBodyShadingGradeMap.hlsl @@ -157,10 +157,8 @@ float4 _ShadingGradeMap_var = tex2Dlod(_ShadingGradeMap, float4(TRANSFORM_TEX(Set_UV0, _ShadingGradeMap), 0.0, _BlurLevelSGM)); //the value of shadowAttenuation is darker than legacy and it cuases noise in terminaters. -#if !defined (UTS_USE_RAYTRACING_SHADOW) shadowAttenuation *= 2.0f; shadowAttenuation = saturate(shadowAttenuation); -#endif //v.2.0.6 //Minmimum value is same as the Minimum Feather's value with the Minimum Step's value as threshold.