From 1aa73f3471b12d5fed9feb76a25c40ccf3969ce8 Mon Sep 17 00:00:00 2001 From: yum Date: Sat, 10 Aug 2024 01:08:46 -0700 Subject: Add metallic/roughness to decals Also add ability to limit cubemap override to metallic regions of material. Also rename `uv` to `uv0` where appropriate. This is to begin supporting multiple UV maps. --- Editor/tooner.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'Editor') diff --git a/Editor/tooner.cs b/Editor/tooner.cs index 166241d..76aaffc 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -316,6 +316,19 @@ public class ToonerGUI : ShaderGUI { if (bc.textureValue) { editor.TextureScaleOffsetProperty(bc); } + + bc = FindProperty($"_Decal{i}_Roughness"); + editor.TexturePropertySingleLine( + MakeLabel(bc, "Roughness"), + bc); + SetKeyword($"_DECAL{i}_ROUGHNESS", bc.textureValue); + + bc = FindProperty($"_Decal{i}_Metallic"); + editor.TexturePropertySingleLine( + MakeLabel(bc, "Metallic"), + bc); + SetKeyword($"_DECAL{i}_METALLIC", bc.textureValue); + bc = FindProperty($"_Decal{i}_Emission_Strength"); editor.FloatProperty( bc, @@ -324,6 +337,12 @@ public class ToonerGUI : ShaderGUI { editor.RangeProperty( bc, "Angle"); + + bc = FindProperty($"_Decal{i}_UV_Select"); + editor.RangeProperty( + bc, + "UV"); + } EditorGUI.indentLevel -= 1; @@ -1355,6 +1374,16 @@ public class ToonerGUI : ShaderGUI { bc); SetKeyword("_CUBEMAP", bc.textureValue); + if (bc.textureValue) { + bc = FindProperty("_Cubemap_Limit_To_Metallic"); + bool cube_lim_enabled = bc.floatValue > 1E-6; + EditorGUI.BeginChangeCheck(); + cube_lim_enabled = EditorGUILayout.Toggle("Limit to metallic", + cube_lim_enabled); + EditorGUI.EndChangeCheck(); + bc.floatValue = cube_lim_enabled ? 1.0f : 0.0f; + } + bc = FindProperty("_Lighting_Factor"); editor.RangeProperty( bc, -- cgit v1.2.3