From d4b2d29792b44eab941019713fa7b3df5f460443 Mon Sep 17 00:00:00 2001 From: yum Date: Sat, 17 Aug 2024 14:33:03 -0700 Subject: Add proximity dimming feature Also overhaul brightness clamping code. It now occurs in HSV space. --- Editor/tooner.cs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'Editor') diff --git a/Editor/tooner.cs b/Editor/tooner.cs index e0a8bfc..53bdc46 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -1495,9 +1495,32 @@ public class ToonerGUI : ShaderGUI { "Mipmap multiplier"); bc.floatValue = (float) Math.Max(1E-6, bc.floatValue); + bc = FindProperty("_Proximity_Dimming_Enable_Static"); + bool enabled = bc.floatValue > 1E-6; + EditorGUI.BeginChangeCheck(); + enabled = EditorGUILayout.Toggle("Proximity dimming", enabled); + EditorGUI.EndChangeCheck(); + bc.floatValue = enabled ? 1.0f : 0.0f; + SetKeyword("_PROXIMITY_DIMMING", enabled); + + if (enabled) { + EditorGUI.indentLevel += 1; + + bc = FindProperty("_Proximity_Dimming_Min_Dist"); + editor.FloatProperty(bc, "Min distance"); + + bc = FindProperty("_Proximity_Dimming_Max_Dist"); + editor.FloatProperty(bc, "Max distance"); + + bc = FindProperty("_Proximity_Dimming_Factor"); + editor.FloatProperty(bc, "Dimming factor"); + + EditorGUI.indentLevel -= 1; + } + #if LTCGI_INCLUDED bc = FindProperty("_LTCGI_Enabled"); - bool enabled = bc.floatValue > 1E-6; + enabled = bc.floatValue > 1E-6; EditorGUI.BeginChangeCheck(); enabled = EditorGUILayout.Toggle("Enable LTCGI", enabled); EditorGUI.EndChangeCheck(); -- cgit v1.2.3