diff --git a/MToon/Editor/MToonInspector.cs b/MToon/Editor/MToonInspector.cs index 6e2f14a..0d70d06 100644 --- a/MToon/Editor/MToonInspector.cs +++ b/MToon/Editor/MToonInspector.cs @@ -209,15 +209,8 @@ private void Draw(MaterialEditor materialEditor, Material[] materials) EditorGUILayout.LabelField("Emission", EditorStyles.boldLabel); EditorGUILayout.BeginVertical(GUI.skin.box); { - materialEditor.TexturePropertyWithHDRColor(new GUIContent("Emission", "Emission (RGB)"), - _emissionMap, - _emissionColor, -#if UNITY_2018_1_OR_NEWER -#else - new ColorPickerHDRConfig(minBrightness: 0, maxBrightness: 10, minExposureValue: -10, - maxExposureValue: 10), -#endif - showAlpha: false); + TextureWithHdrColor(materialEditor, "Emission", "Emission (RGB)", + _emissionMap, _emissionColor); materialEditor.TexturePropertySingleLine(new GUIContent("MatCap", "MatCap Texture (RGB)"), _sphereAdd); @@ -228,7 +221,7 @@ private void Draw(MaterialEditor materialEditor, Material[] materials) EditorGUILayout.LabelField("Rim", EditorStyles.boldLabel); EditorGUILayout.BeginVertical(GUI.skin.box); { - materialEditor.TexturePropertySingleLine(new GUIContent("Color", "Rim Color (RGB)"), + TextureWithHdrColor(materialEditor, "Color", "Rim Color (RGB)", _rimTexture, _rimColor); materialEditor.DefaultShaderProperty(_rimLightingMix, "Lighting Mix"); @@ -388,5 +381,19 @@ private static bool PopupEnum(string name, MaterialProperty property, Materia return changed; } + private static void TextureWithHdrColor(MaterialEditor materialEditor, string label, string description, + MaterialProperty texProp, MaterialProperty colorProp) + { + materialEditor.TexturePropertyWithHDRColor(new GUIContent(label, description), + texProp, + colorProp, +#if UNITY_2018_1_OR_NEWER +#else + new ColorPickerHDRConfig(minBrightness: 0, maxBrightness: 10, minExposureValue: -10, + maxExposureValue: 10), +#endif + showAlpha: false); + + } } } \ No newline at end of file diff --git a/MToon/Resources/Shaders/MToon.shader b/MToon/Resources/Shaders/MToon.shader index f477097..95d638a 100644 --- a/MToon/Resources/Shaders/MToon.shader +++ b/MToon/Resources/Shaders/MToon.shader @@ -17,13 +17,13 @@ Shader "VRM/MToon" _ShadeToony ("Shade Toony", Range(0, 1)) = 0.9 _LightColorAttenuation ("Light Color Attenuation", Range(0, 1)) = 0 _IndirectLightIntensity ("Indirect Light Intensity", Range(0, 1)) = 0.1 - _RimColor ("Rim Color", Color) = (0,0,0) + [HDR] _RimColor ("Rim Color", Color) = (0,0,0) [NoScaleOffset] _RimTexture ("Rim Texture", 2D) = "white" {} _RimLightingMix ("Rim Lighting Mix", Range(0, 1)) = 0 [PowerSlider(4.0)] _RimFresnelPower ("Rim Fresnel Power", Range(0, 100)) = 1 _RimLift ("Rim Lift", Range(0, 1)) = 0 [NoScaleOffset] _SphereAdd ("Sphere Texture(Add)", 2D) = "black" {} - _EmissionColor ("Color", Color) = (0,0,0) + [HDR] _EmissionColor ("Color", Color) = (0,0,0) [NoScaleOffset] _EmissionMap ("Emission", 2D) = "white" {} [NoScaleOffset] _OutlineWidthTexture ("Outline Width Tex", 2D) = "white" {} _OutlineWidth ("Outline Width", Range(0.01, 1)) = 0.5