Add shadowcaster blur support to shaders

Introduces a _BlurPixels property and related parameters to BlendinShader and LitParticles shaders, enabling blurred shadowcaster sampling. Updates Shadowcaster.cginc to support blurred texture sampling using tex2Dgrad when blur is enabled. Also adjusts light intensity calculation in LightStrength.hlsl to remove NdotL multiplication for consistency with new shadow handling.
This commit is contained in:
DeMuenu
2025-10-01 14:48:44 +02:00
parent 0e633983cf
commit 8e740bd636
4 changed files with 40 additions and 14 deletions

View File

@@ -9,6 +9,9 @@ Shader "DeMuenu/World/Hoppou/Particles/LitParticles"
//Moonlight
_InverseSqareMultiplier ("Inverse Square Multiplier", Float) = 1
_LightCutoffDistance ("Light Cutoff Distance", Float) = 100
_BlurPixels ("Shadowcaster Blur Pixels", Float) = 0
//Moonlight END
@@ -98,6 +101,11 @@ Shader "DeMuenu/World/Hoppou/Particles/LitParticles"
float4 _Udon_shadowCasterColor_2;
float4 _Udon_OutSideColor_2;
float _Udon_MinBrightnessShadow_2;
float _BlurPixels;
float4 _Udon_shadowCasterTex_1_TexelSize; // xy = 1/width, 1/height
float4 _Udon_shadowCasterTex_2_TexelSize;
v2f vert (appdata v)
{
v2f o;
@@ -144,16 +152,15 @@ Shader "DeMuenu/World/Hoppou/Particles/LitParticles"
float4 sc1 = SampleShadowcasterPlaneWS_Basis(
_Udon_LightPositions[LightCounter].xyz, i.worldPos,
_Udon_Plane_Origin_1.xyz, _Udon_Plane_Uinv_1.xyz, _Udon_Plane_Vinv_1.xyz, _Udon_Plane_Normal_1.xyz,
_Udon_shadowCasterTex_1, _Udon_OutSideColor_1, _Udon_shadowCasterColor_1);
_Udon_shadowCasterTex_1, _Udon_OutSideColor_1, _Udon_shadowCasterColor_1, _BlurPixels, _Udon_shadowCasterTex_1_TexelSize.xy);
ShadowCasterMult_1 = max(sc1, _Udon_MinBrightnessShadow_1);
}
if (_Udon_ShadowMapIndex[LightCounter] > 1.5)
{
float4 sc2 = SampleShadowcasterPlaneWS_Basis(
_Udon_LightPositions[LightCounter].xyz, i.worldPos,
_Udon_Plane_Origin_2.xyz, _Udon_Plane_Uinv_2.xyz, _Udon_Plane_Vinv_2.xyz, _Udon_Plane_Normal_2.xyz,
_Udon_shadowCasterTex_2, _Udon_OutSideColor_2, _Udon_shadowCasterColor_2);
_Udon_shadowCasterTex_2, _Udon_OutSideColor_2, _Udon_shadowCasterColor_2, _BlurPixels, _Udon_shadowCasterTex_2_TexelSize.xy);
ShadowCasterMult_2 = max(sc2, _Udon_MinBrightnessShadow_2);
}