From 9bfb0bf53419330ff27565e65a80873e3e5defbb Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 23 Jun 2025 01:01:52 -0700 Subject: more filamented tweaks --- yum_lighting.cginc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'yum_lighting.cginc') diff --git a/yum_lighting.cginc b/yum_lighting.cginc index e769375..ade45ae 100644 --- a/yum_lighting.cginc +++ b/yum_lighting.cginc @@ -113,6 +113,13 @@ float3 getDirectLightDirection(v2f i) { #endif } +float4 getDirectLightColorIntensity() { + // Properly separate light color from intensity like filamented + if (_LightColor0.w <= 0) return float4(0, 0, 0, 0); + _LightColor0 += 0.000001; // Avoid division by zero + return float4(_LightColor0.xyz / _LightColor0.w, _LightColor0.w); +} + float GetLodRoughness(float roughness) { return roughness * (1.7 - 0.7 * roughness); } @@ -195,7 +202,9 @@ YumLighting GetYumLighting(v2f i, YumPbr pbr) { light.dir = getDirectLightDirection(i); - light.direct = _LightColor0.rgb; + // Use proper light color/intensity separation + float4 lightColorIntensity = getDirectLightColorIntensity(); + light.direct = lightColorIntensity.rgb * lightColorIntensity.w; // Calculate attenuation first, before diffuse lighting light.attenuation = getShadowAttenuation(i); -- cgit v1.2.3