mirror of
https://github.com/DeMuenu/MoonlightVRC.git
synced 2025-12-13 19:33:56 +00:00
Add support for multiple shadowcaster planes
Extended ShadowcasterUpdater and shaders to handle multiple shadowcaster planes by introducing indexed properties and logic for two shadowcaster sets. Updated property names and shader logic to support per-index shadowcaster textures, colors, and brightness, enabling more flexible shadow casting in scenes.
This commit is contained in:
@@ -92,6 +92,17 @@ Shader "DeMuenu/World/Hoppou/RevealStandart"
|
||||
|
||||
MoonlightGlobalVariables
|
||||
|
||||
float4x4 _Udon_WorldToLocal_1;
|
||||
sampler2D _Udon_shadowCasterTex_1;
|
||||
float4 _Udon_shadowCasterColor_1;
|
||||
float4 _Udon_OutSideColor_1;
|
||||
float _Udon_MinBrightnessShadow_1;
|
||||
|
||||
float4x4 _Udon_WorldToLocal_2;
|
||||
sampler2D _Udon_shadowCasterTex_2;
|
||||
float4 _Udon_shadowCasterColor_2;
|
||||
float4 _Udon_OutSideColor_2;
|
||||
float _Udon_MinBrightnessShadow_2;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
@@ -148,15 +159,22 @@ Shader "DeMuenu/World/Hoppou/RevealStandart"
|
||||
|
||||
LightTypeCalculations(_Udon_LightColors, LightCounter, i, NdotL, dIntensity, _Udon_LightPositions[LightCounter].a, _Udon_LightPositions[LightCounter].xyz);
|
||||
|
||||
float4 ShadowCasterMult = float4(1,1,1,1);
|
||||
if (_Udon_ShadowMapIndex[LightCounter] > 0.5) {
|
||||
ShadowCasterMult = SampleShadowcasterPlane(_Udon_WorldToLocal, _shadowCasterTex, _Udon_LightPositions[LightCounter].xyz, i.worldPos, _OutSideColor);
|
||||
ShadowCasterMult *= _shadowCasterColor;
|
||||
ShadowCasterMult = float4(ShadowCasterMult.rgb * (1-ShadowCasterMult.a), 1);
|
||||
float4 ShadowCasterMult_1 = float4(1,1,1,1);
|
||||
float4 ShadowCasterMult_2 = float4(1,1,1,1);
|
||||
if (((_Udon_ShadowMapIndex[LightCounter] > 0.5) && (_Udon_ShadowMapIndex[LightCounter] < 1.5)) || (_Udon_ShadowMapIndex[LightCounter] > 2.5)) {
|
||||
ShadowCasterMult_1 = SampleShadowcasterPlane(_Udon_WorldToLocal_1, _Udon_shadowCasterTex_1, _Udon_LightPositions[LightCounter].xyz, i.worldPos, _Udon_OutSideColor_1);
|
||||
ShadowCasterMult_1 *= _Udon_shadowCasterColor_1;
|
||||
ShadowCasterMult_1 = float4(ShadowCasterMult_1.rgb * (1-ShadowCasterMult_1.a), 1);
|
||||
ShadowCasterMult_1 = max(ShadowCasterMult_1, _Udon_MinBrightnessShadow_1)
|
||||
}
|
||||
if (_Udon_ShadowMapIndex[LightCounter] > 1.5) {
|
||||
ShadowCasterMult_2 = SampleShadowcasterPlane(_Udon_WorldToLocal_2, _Udon_shadowCasterTex_2, _Udon_LightPositions[LightCounter].xyz, i.worldPos, _Udon_OutSideColor_2);
|
||||
ShadowCasterMult_2 *= _Udon_shadowCasterColor_2;
|
||||
ShadowCasterMult_2 = float4(ShadowCasterMult_2.rgb * (1-ShadowCasterMult_2.a), 1);
|
||||
ShadowCasterMult_2 = max(ShadowCasterMult_2, _Udon_MinBrightnessShadow_2)
|
||||
}
|
||||
|
||||
|
||||
dmax = dmax + contrib * float4(LightColor, 1) * NdotL * max(ShadowCasterMult, _MinBrightnessShadow);
|
||||
dmax = dmax + contrib * float4(LightColor, 1) * ShadowCasterMult_1 * ShadowCasterMult_2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user