Skip to content

Commit

Permalink
rim color as hdr
Browse files Browse the repository at this point in the history
  • Loading branch information
Santarh committed May 24, 2019
1 parent f825847 commit 6e18df3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
27 changes: 17 additions & 10 deletions MToon/Editor/MToonInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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");
Expand Down Expand Up @@ -388,5 +381,19 @@ private static bool PopupEnum<T>(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);

}
}
}
4 changes: 2 additions & 2 deletions MToon/Resources/Shaders/MToon.shader
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6e18df3

Please sign in to comment.