summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-02-27 18:22:26 -0800
committeryum <yum.food.vr@gmail.com>2025-02-27 18:22:26 -0800
commitef269f0cf30c21954632de10487e29f0550e1049 (patch)
treecbf2fbc00fe273828b709bc3b84e149e46b5564d
parentef6b610577f851d8c70840f945c0ec2161450302 (diff)
add brightness control
-rw-r--r--2ner.shader6
-rw-r--r--features.cginc4
-rw-r--r--globals.cginc4
-rw-r--r--yum_lighting.cginc6
4 files changed, 20 insertions, 0 deletions
diff --git a/2ner.shader b/2ner.shader
index 91008b6..6968ff3 100644
--- a/2ner.shader
+++ b/2ner.shader
@@ -558,6 +558,12 @@ Shader "yum_food/2ner"
_Wrap_NoL_Specular_Strength("Specular strength", Range(0, 1)) = 0.1
[HideInInspector] m_end_WrappedLighting("Wrapped lighting", Float) = 0
//endex
+ //ifex _Brightness_Control_Enabled==0
+ [HideInInspector] m_start_Brightness_Control("Brightness", Float) = 0
+ [ThryToggle(_BRIGHTNESS_CONTROL)] _Brightness_Control_Enabled("Enable", Float) = 0
+ _Brightness_Multiplier("Brightness multiplier", Float) = 1.0
+ [HideInInspector] m_end_Brightness_Control("Brightness", Float) = 0
+ //endex
//ifex _Min_Brightness_Enabled==0
[HideInInspector] m_start_Min_Brightness("Minimum brightness", Float) = 0
[ThryToggle(_MIN_BRIGHTNESS)] _Min_Brightness_Enabled("Enable", Float) = 0
diff --git a/features.cginc b/features.cginc
index 7f0fe79..3a18b8b 100644
--- a/features.cginc
+++ b/features.cginc
@@ -21,6 +21,10 @@
#pragma shader_feature_local _WRAPPED_LIGHTING
//endex
+//ifex _Brightness_Control_Enabled==0
+#pragma shader_feature_local _BRIGHTNESS_CONTROL
+//endex
+
//ifex _Min_Brightness_Enabled==0
#pragma shader_feature_local _MIN_BRIGHTNESS
//endex
diff --git a/globals.cginc b/globals.cginc
index 20f866c..02ef011 100644
--- a/globals.cginc
+++ b/globals.cginc
@@ -46,6 +46,10 @@ float _Wrap_NoL_Diffuse_Strength;
float _Wrap_NoL_Specular_Strength;
#endif
+#if defined(_BRIGHTNESS_CONTROL)
+float _Brightness_Multiplier;
+#endif
+
#if defined(_MIN_BRIGHTNESS)
float _Min_Brightness;
#endif
diff --git a/yum_lighting.cginc b/yum_lighting.cginc
index 312e4a6..8570488 100644
--- a/yum_lighting.cginc
+++ b/yum_lighting.cginc
@@ -187,6 +187,12 @@ YumLighting GetYumLighting(v2f i, YumPbr pbr) {
light.diffuse = light.diffuse * floor(diffuse_luminance * _Quantize_Diffuse_Steps) / _Quantize_Diffuse_Steps;
#endif
+#if defined(_BRIGHTNESS_CONTROL)
+ light.direct *= _Brightness_Multiplier;
+ light.diffuse *= _Brightness_Multiplier;
+ light.specular *= _Brightness_Multiplier;
+#endif
+
light.NoL = dot(pbr.normal, light.dir);
#if defined(_QUANTIZE_NOL)
light.NoL = floor(light.NoL * _Quantize_NoL_Steps) / _Quantize_NoL_Steps;