summaryrefslogtreecommitdiffstats
path: root/lighting.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-02-24 18:22:33 -0800
committeryum <yum.food.vr@gmail.com>2026-02-24 18:22:33 -0800
commit610607592438452e181eba98f05d58f838975266 (patch)
treeb9697fd0be355c01baa70e2f82ea95af4675eb37 /lighting.cginc
parentaacad28954ceb792ecc7ebd90338466b9f70d456 (diff)
Bugfix: spherical harmonics L0 was being added twice
Diffstat (limited to 'lighting.cginc')
-rwxr-xr-xlighting.cginc2
1 files changed, 1 insertions, 1 deletions
diff --git a/lighting.cginc b/lighting.cginc
index cae24d0..f39d866 100755
--- a/lighting.cginc
+++ b/lighting.cginc
@@ -148,7 +148,7 @@ float3 yumSH9(float4 n, float3 worldPos, inout LightIndirect light) {
// L0+L1: dot4 per channel (n.w=1 picks up the L0 term from SHA*.w)
// L2: four quadratic terms packed into vB via swizzle multiply, plus L22
float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
- float3 L1 = float3(dot(unity_SHAr, n), dot(unity_SHAg, n), dot(unity_SHAb, n));
+ float3 L1 = float3(dot(unity_SHAr, n.xyz), dot(unity_SHAg, n.xyz), dot(unity_SHAb, n.xyz));
float4 vB = n.xyzz * n.yzzx;
float3 L2 = float3(dot(unity_SHBr, vB), dot(unity_SHBg, vB), dot(unity_SHBb, vB))
+ unity_SHC * (n.x * n.x - n.y * n.y);