diff --git a/Assets/VRMShaders/VRM10/MToon10/Editor/MToon10EditorEditMode.cs b/Assets/VRMShaders/VRM10/MToon10/Editor/MToon10EditorEditMode.cs new file mode 100644 index 000000000..07855be10 --- /dev/null +++ b/Assets/VRMShaders/VRM10/MToon10/Editor/MToon10EditorEditMode.cs @@ -0,0 +1,8 @@ +namespace VRMShaders.VRM10.MToon10.Editor +{ + public enum MToon10EditorEditMode + { + Basic = 0, + Advanced = 1, + } +} \ No newline at end of file diff --git a/Assets/VRMShaders/VRM10/MToon10/Editor/MToon10EditorEditMode.cs.meta b/Assets/VRMShaders/VRM10/MToon10/Editor/MToon10EditorEditMode.cs.meta new file mode 100644 index 000000000..924035f7a --- /dev/null +++ b/Assets/VRMShaders/VRM10/MToon10/Editor/MToon10EditorEditMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 22a9170004064d029bc205fc5b5a1acc +timeCreated: 1626335293 \ No newline at end of file diff --git a/Assets/VRMShaders/VRM10/MToon10/Editor/MToonInspector.cs b/Assets/VRMShaders/VRM10/MToon10/Editor/MToonInspector.cs index a3e452ae9..438e4bb34 100644 --- a/Assets/VRMShaders/VRM10/MToon10/Editor/MToonInspector.cs +++ b/Assets/VRMShaders/VRM10/MToon10/Editor/MToonInspector.cs @@ -77,16 +77,55 @@ namespace VRMShaders.VRM10.MToon10.Editor } EditorGUILayout.Space(); - materialEditor.ShaderProperty(props[MToon10Prop.ShadingToonyFactor], "Shading Toony"); - materialEditor.ShaderProperty(props[MToon10Prop.ShadingShiftFactor], "Shading Shift"); if (isAdvancedEditMode) { + materialEditor.ShaderProperty(props[MToon10Prop.ShadingToonyFactor], "Shading Toony"); + materialEditor.ShaderProperty(props[MToon10Prop.ShadingShiftFactor], "Shading Shift"); materialEditor.TexturePropertySingleLine( new GUIContent("Additive Shading Shift", "Shading Shift (R)"), props[MToon10Prop.ShadingShiftTexture], props[MToon10Prop.ShadingShiftTextureScale] ); } + else + { + EditorGUILayout.BeginHorizontal(); + GUILayout.Label("Presets"); + if (GUILayout.Button("Default")) + { + props[MToon10Prop.ShadingToonyFactor].floatValue = 0.95f; + props[MToon10Prop.ShadingShiftFactor].floatValue = -0.05f; + props[MToon10Prop.ShadingShiftTexture].textureValue = null; + } + if (GUILayout.Button("Lambert")) + { + props[MToon10Prop.ShadingToonyFactor].floatValue = 0.5f; + props[MToon10Prop.ShadingShiftFactor].floatValue = -0.5f; + props[MToon10Prop.ShadingShiftTexture].textureValue = null; + } + if (GUILayout.Button("Cartoon")) + { + props[MToon10Prop.ShadingToonyFactor].floatValue = 1.0f; + props[MToon10Prop.ShadingShiftFactor].floatValue = 0.0f; + props[MToon10Prop.ShadingShiftTexture].textureValue = null; + } + EditorGUILayout.EndHorizontal(); + + GUILayout.BeginVertical(GUI.skin.box); + materialEditor.ShaderProperty(props[MToon10Prop.ShadingToonyFactor], "Shading Toony"); + materialEditor.ShaderProperty(props[MToon10Prop.ShadingShiftFactor], "Shading Shift"); + GUILayout.EndVertical(); + } + + if (props[MToon10Prop.ShadingShiftTexture].textureValue == null) + { + var toony = props[MToon10Prop.ShadingToonyFactor].floatValue; + var shift = props[MToon10Prop.ShadingShiftFactor].floatValue; + if (toony - shift < 1.0f - 0.001f) + { + EditorGUILayout.HelpBox("The lit area includes non-lit area.", MessageType.Warning); + } + } } if (isAdvancedEditMode) diff --git a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon.shader b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon.shader index 53927223f..f4c59d7d0 100644 --- a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon.shader +++ b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon.shader @@ -16,10 +16,10 @@ Shader "VRM10/MToon10" _ShadeTex ("mtoon.shadeMultiplyTexture", 2D) = "white" {} [Normal] _BumpMap ("normalTexture", 2D) = "bump" {} // Unity specified name _BumpScale ("normalTexture.scale", Float) = 1.0 // Unity specified name - _ShadingShiftFactor ("mtoon.shadingShiftFactor", Range(-1, 1)) = 0 + _ShadingShiftFactor ("mtoon.shadingShiftFactor", Range(-1, 1)) = -0.05 _ShadingShiftTex ("mtoon.shadingShiftTexture", 2D) = "black" {} // channel R _ShadingShiftTexScale ("mtoon.shadingShiftTexture.scale", Float) = 1 - _ShadingToonyFactor ("mtoon.shadingToonyFactor", Range(0, 1)) = 0.9 + _ShadingToonyFactor ("mtoon.shadingToonyFactor", Range(0, 1)) = 0.95 // GI _GiEqualization ("mtoon.giEqualizationFactor", Range(0, 1)) = 0.9