From 1a62981f052ca321ca47627d41cda83e8ea60420 Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 27 May 2024 13:28:38 -0700 Subject: Add mix modes to PBR overlay albedo channel --- Editor/tooner.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Editor') diff --git a/Editor/tooner.cs b/Editor/tooner.cs index 184b653..f984f6a 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -98,6 +98,13 @@ public class ToonerGUI : ShaderGUI { SetKeyword("_ROUGHNESS_MAP", bct.textureValue); } + enum PbrAlbedoMixMode { + AlphaBlend, + Add, + Min, + Max + }; + void DoPBROverlay() { for (int i = 0; i < 4; i++) { GUILayout.Label($"PBR overlay {i}", EditorStyles.boldLabel); @@ -123,6 +130,22 @@ public class ToonerGUI : ShaderGUI { } SetKeyword($"_PBR_OVERLAY{i}_BASECOLOR_MAP", bct.textureValue); + EditorGUI.BeginChangeCheck(); + bc = FindProperty($"_PBR_Overlay{i}_Mix"); + PbrAlbedoMixMode mode = (PbrAlbedoMixMode) Math.Round(bc.floatValue); + mode = (PbrAlbedoMixMode) EditorGUILayout.EnumPopup( + MakeLabel("Mix mode"), mode); + if (EditorGUI.EndChangeCheck()) { + RecordAction($"PBR overlay mix mode {i}"); + foreach (Material m in editor.targets) { + m.SetFloat($"_PBR_Overlay{i}_Mix", (int) mode); + } + } + SetKeyword($"_PBR_OVERLAY{i}_MIX_ALPHA_BLEND", mode == PbrAlbedoMixMode.AlphaBlend); + SetKeyword($"_PBR_OVERLAY{i}_MIX_ADD", mode == PbrAlbedoMixMode.Add); + SetKeyword($"_PBR_OVERLAY{i}_MIX_MIN", mode == PbrAlbedoMixMode.Min); + SetKeyword($"_PBR_OVERLAY{i}_MIX_MAX", mode == PbrAlbedoMixMode.Max); + bct = FindProperty($"_PBR_Overlay{i}_NormalTex"); editor.TexturePropertySingleLine( MakeLabel(bct, "Normal"), -- cgit v1.2.3