mirror of
https://github.com/DeMuenu/MoonlightVRC.git
synced 2025-12-13 11:33:54 +00:00
Refactor light range and angle calculations
Updated how light range and spot angle are calculated and packed for both editor and runtime scripts, distinguishing between sphere and non-sphere lights. Adjusted shader logic to use new packing for spot light contribution, improving consistency between CPU and GPU representations.
This commit is contained in:
@@ -11,10 +11,9 @@
|
||||
else if (_Udon_LightType[LightCounter] == 1) \
|
||||
{ \
|
||||
float invSq = _Udon_LightColors[LightCounter].a / max(1e-4, (distanceFromLight * invSqMul) * (distanceFromLight * invSqMul)); \
|
||||
float threshold = (-1 + _Udon_LightDirections[LightCounter].w / 180); \
|
||||
\
|
||||
contrib = min(dot(normalize(i.worldPos - Lightposition), -normalize(_Udon_LightDirections[LightCounter].xyz)), 0); \
|
||||
contrib= 1 - smoothstep(threshold, threshold + radius / 180, contrib); \
|
||||
contrib = dot(normalize(i.worldPos - Lightposition), normalize(_Udon_LightDirections[LightCounter].xyz)); \
|
||||
contrib = smoothstep(radius,_Udon_LightDirections[LightCounter].w, contrib); \
|
||||
\
|
||||
contrib = contrib * invSq; \
|
||||
dIntensity += contrib; \
|
||||
|
||||
Reference in New Issue
Block a user