summaryrefslogtreecommitdiffstats
path: root/Editor
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-05-27 13:28:38 -0700
committeryum <yum.food.vr@gmail.com>2024-05-27 13:28:38 -0700
commit1a62981f052ca321ca47627d41cda83e8ea60420 (patch)
tree3f9c36933b8414459a0a8c335ab2a41c148211bb /Editor
parent33b2b8a3ab0ddea85c7a3f03f918fe5ee6874426 (diff)
Add mix modes to PBR overlay albedo channel
Diffstat (limited to 'Editor')
-rw-r--r--Editor/tooner.cs23
1 files changed, 23 insertions, 0 deletions
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"),