diff --git a/EditorPreview/LightUpdater.Editor.cs b/EditorPreview/LightUpdater.Editor.cs index 9dc7024..41543d8 100644 --- a/EditorPreview/LightUpdater.Editor.cs +++ b/EditorPreview/LightUpdater.Editor.cs @@ -38,7 +38,7 @@ public partial class LightUpdater float intensity = (data != null) ? data.intensity * t.localScale.x : 1f; // w = cosHalfAngle (0 for omni) - float cosHalf = (data != null) ? data.GetCosHalfAngle() : 0f; + float cosHalf = (data != null) ? data.spotAngleDeg : 0f; // 0=Omni, 1=Spot, 2=Directional (your custom enum) int typeId = (data != null) ? data.GetTypeId() : 0; diff --git a/Scripts/LightUpdater.cs b/Scripts/LightUpdater.cs index b9ad5be..372a024 100644 --- a/Scripts/LightUpdater.cs +++ b/Scripts/LightUpdater.cs @@ -221,7 +221,7 @@ public partial class LightUpdater : UdonSharpBehaviour Vector3 fwd = rot * Vector3.down; - float cosHalf = (data != null) ? data.GetCosHalfAngle() : 0f; + float Lightangle = (data != null) ? data.spotAngleDeg : 0f; Vector4 posTemp = new Vector4(pos.x, pos.y, pos.z, range); if (_positions[currentCount] != posTemp) @@ -235,7 +235,7 @@ public partial class LightUpdater : UdonSharpBehaviour _lightColors[currentCount] = colorTemp; _lightColors_isDirty = true; } - Vector4 dirTemp = new Vector4(fwd.x, fwd.y, fwd.z, cosHalf); + Vector4 dirTemp = new Vector4(fwd.x, fwd.y, fwd.z, Lightangle); if (_directions[currentCount] != dirTemp) { _directions[currentCount] = dirTemp; diff --git a/Shader/Includes/LightStrength.hlsl b/Shader/Includes/LightStrength.hlsl index d9119d0..d858403 100644 --- a/Shader/Includes/LightStrength.hlsl +++ b/Shader/Includes/LightStrength.hlsl @@ -14,7 +14,7 @@ float threshold = (-1 + _Udon_LightDirections[LightCounter].w / 180); \ \ contrib = min(dot(normalize(i.worldPos - Lightposition), -normalize(_Udon_LightDirections[LightCounter].xyz)), 0); \ - contrib= 1 - step(threshold, contrib); \ + contrib= 1 - smoothstep(threshold, threshold + radius / 180, contrib); \ \ contrib = contrib * invSq; \ dIntensity += contrib; \