Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rim color as HDR. #55

Merged
merged 1 commit into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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