mirror of
https://github.com/DeMuenu/MoonlightVRC.git
synced 2025-12-13 19:33:56 +00:00
Add shadow casting toggle to shaders
Introduced an _EnableShadowCasting property to BlendinShader, LitParticles, and Water shaders, allowing shadow casting to be enabled or disabled via a material parameter. Updated shadow sampling logic to respect this toggle, and added related parameters and includes where necessary. Also added a Cull Mode property to BlendinShader for improved rendering control.
This commit is contained in:
@@ -16,9 +16,11 @@ Shader "DeMuenu/World/Hoppou/RevealStandart"
|
||||
_InverseSqareMultiplier ("Inverse Square Multiplier", Float) = 1
|
||||
_LightCutoffDistance ("Light Cutoff Distance", Float) = 100
|
||||
|
||||
_EnableShadowCasting ("Enable Shadowcasting", Float) = 0
|
||||
_BlurPixels ("Shadowcaster Blur Pixels", Float) = 0
|
||||
//Moonlight END
|
||||
|
||||
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull Mode", Float) = 2
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +29,7 @@ Shader "DeMuenu/World/Hoppou/RevealStandart"
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
Cull[_Cull]
|
||||
|
||||
Pass
|
||||
{
|
||||
@@ -113,6 +116,8 @@ Shader "DeMuenu/World/Hoppou/RevealStandart"
|
||||
float4 _Udon_shadowCasterTex_1_TexelSize; // xy = 1/width, 1/height
|
||||
float4 _Udon_shadowCasterTex_2_TexelSize;
|
||||
|
||||
bool _EnableShadowCasting;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
@@ -171,7 +176,7 @@ Shader "DeMuenu/World/Hoppou/RevealStandart"
|
||||
float4 ShadowCasterMult_1 = 1;
|
||||
float4 ShadowCasterMult_2 = 1;
|
||||
|
||||
if (((_Udon_ShadowMapIndex[LightCounter] > 0.5) && (_Udon_ShadowMapIndex[LightCounter] < 1.5)) || (_Udon_ShadowMapIndex[LightCounter] > 2.5))
|
||||
if (((_Udon_ShadowMapIndex[LightCounter] > 0.5) && (_Udon_ShadowMapIndex[LightCounter] < 1.5) && (_EnableShadowCasting > 0.5)) || (_Udon_ShadowMapIndex[LightCounter] > 2.5 && _EnableShadowCasting))
|
||||
{
|
||||
float4 sc1 = SampleShadowcasterPlaneWS_Basis(
|
||||
_Udon_LightPositions[LightCounter].xyz, i.worldPos,
|
||||
@@ -179,7 +184,7 @@ Shader "DeMuenu/World/Hoppou/RevealStandart"
|
||||
_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)
|
||||
if (_Udon_ShadowMapIndex[LightCounter] > 1.5 && (_EnableShadowCasting > 0.5))
|
||||
{
|
||||
float4 sc2 = SampleShadowcasterPlaneWS_Basis(
|
||||
_Udon_LightPositions[LightCounter].xyz, i.worldPos,
|
||||
|
||||
Reference in New Issue
Block a user