summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-08-17 15:28:39 -0700
committeryum <yum.food.vr@gmail.com>2024-08-17 15:28:39 -0700
commit70a2bb45f805fd420aeccf4cde1400a33c4199a5 (patch)
tree0f538de0d3c8b08a58db268693981c5642bb9dd6
parentd4b2d29792b44eab941019713fa7b3df5f460443 (diff)
Put lighting factors after clamp
-rw-r--r--pbr.cginc8
1 files changed, 4 insertions, 4 deletions
diff --git a/pbr.cginc b/pbr.cginc
index ef8b1d4..5ba9cae 100644
--- a/pbr.cginc
+++ b/pbr.cginc
@@ -261,10 +261,6 @@ float4 getLitColor(
}
#endif
- direct_light.color[2] *= _Lighting_Factor * _Direct_Lighting_Factor * enable_direct;
- indirect_light.specular[2] *= _Lighting_Factor * _Indirect_Specular_Lighting_Factor;
- indirect_light.diffuse[2] *= _Lighting_Factor * _Indirect_Diffuse_Lighting_Factor;
-
float2 brightnesses = float2(
direct_light.color[2],
indirect_light.diffuse[2]);
@@ -277,6 +273,10 @@ float4 getLitColor(
direct_light.color[2] = sum_brightness * brightness_proportions[0];
indirect_light.diffuse[2] = sum_brightness * brightness_proportions[1];
+ direct_light.color[2] *= _Lighting_Factor * _Direct_Lighting_Factor * enable_direct;
+ indirect_light.specular[2] *= _Lighting_Factor * _Indirect_Specular_Lighting_Factor;
+ indirect_light.diffuse[2] *= _Lighting_Factor * _Indirect_Diffuse_Lighting_Factor;
+
// Specular has to be clamped separately to avoid artifacting.
indirect_light.specular[2] = clamp(indirect_light.specular[2], _Min_Brightness, _Max_Brightness);