diff options
| author | yum <yum.food.vr@gmail.com> | 2025-06-23 01:01:52 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-06-23 01:14:55 -0700 |
| commit | 9bfb0bf53419330ff27565e65a80873e3e5defbb (patch) | |
| tree | 2b3fdb9958aa7450029634386a5e3e31809ad03e /yum_lighting.cginc | |
| parent | 91f89f5cbeed39cfa02ce5c4e7d9d75ce37625ff (diff) | |
more filamented tweaks
Diffstat (limited to 'yum_lighting.cginc')
| -rw-r--r-- | yum_lighting.cginc | 11 |
1 files changed, 10 insertions, 1 deletions
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); |
