Files
MoonlightVRC/Shader/Includes/DefaultSetup.hlsl
2026-03-24 15:45:31 +01:00

24 lines
728 B
HLSL

#ifndef InLoopSetup
#define InLoopSetup(_Udon_LightPositions, LightCounter, count, i) \
if (LightCounter >= count) break; \
\
float3 lightVec = _Udon_LightPositions[LightCounter].xyz - i.worldPos; \
float distanceFromLight = length(lightVec); \
if (distanceFromLight > _LightCutoffDistance) continue; \
\
float contrib = 0.0; \
float3 L = lightVec / max(distanceFromLight, 1e-4);
#endif
#ifndef OutLoopSetup
#define OutLoopSetup(i, _Udon_PlayerCount) \
int count = (int)_Udon_PlayerCount; \
float invSqMul = max(1e-4, _InverseSqareMultiplier); \
bool shadowCastingEnabled = _EnableShadowCasting > 0.5; \
\
float4 dmax = float4(0,0,0,1); \
float dIntensity = 0;
#endif