Added RimLightScope;
This commit is contained in:
141
Editor/MeterialEditor/UIScopes/RimLightScope.cs
Normal file
141
Editor/MeterialEditor/UIScopes/RimLightScope.cs
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
using Misaki.ShaderGUI;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Misaki.HdrpToon.Editor
|
||||||
|
{
|
||||||
|
public class RimLightScope : MaterialUIScope<ShaderGUIExpandable>
|
||||||
|
{
|
||||||
|
private static class Properties
|
||||||
|
{
|
||||||
|
public static MaterialProperty rimLightEnabled;
|
||||||
|
public static MaterialProperty rimLightColor;
|
||||||
|
public static MaterialProperty rimLightStrength;
|
||||||
|
public static MaterialProperty rimLightLevel;
|
||||||
|
public static MaterialProperty colorBlendingMode;
|
||||||
|
public static MaterialProperty adjustRimLightArea;
|
||||||
|
public static MaterialProperty rimLightFeatherOff;
|
||||||
|
public static MaterialProperty lightDirection;
|
||||||
|
public static MaterialProperty lightDirectionRimLightLevel;
|
||||||
|
public static MaterialProperty invertedDirectionRimLight;
|
||||||
|
public static MaterialProperty invertedRimLightColor;
|
||||||
|
public static MaterialProperty inversedRimLightLevel;
|
||||||
|
public static MaterialProperty invertedRimLightFeatherOff;
|
||||||
|
public static MaterialProperty rimLightMaskMap;
|
||||||
|
public static MaterialProperty rimLightMaskLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Styles
|
||||||
|
{
|
||||||
|
public static readonly GUIContent rimLightEnabledText = new("Rim Light",
|
||||||
|
"A light that hits the 3D model from behind and emphasizes the contours of the model from the front.");
|
||||||
|
|
||||||
|
public static readonly GUIContent rimLightColorText =
|
||||||
|
new("Rim Light Color", "Specifies the color of rim light.");
|
||||||
|
|
||||||
|
public static readonly GUIContent rimLightStrengthText =
|
||||||
|
new("Rim Light Strength", "Specifies Rim Light strength.");
|
||||||
|
|
||||||
|
public static readonly GUIContent rimLightLevelText =
|
||||||
|
new("Rim Light Level", "Specifies Rim Light power intensity.");
|
||||||
|
|
||||||
|
public static readonly GUIContent colorBlendingModeText =
|
||||||
|
new("Color Blending Mode", "Rim light color blending mode. Multiply or Add.");
|
||||||
|
|
||||||
|
public static readonly GUIContent adjustRimLightAreaText =
|
||||||
|
new("Adjust Rim Light Area", "Increasing this value narrows the area of influence of Rim Light.");
|
||||||
|
|
||||||
|
public static readonly GUIContent rimLightFeatherOffText =
|
||||||
|
new("Rim Light Feather Off", "Disable Rim light feather.");
|
||||||
|
|
||||||
|
public static readonly GUIContent lightDirectionText =
|
||||||
|
new("Light Direction",
|
||||||
|
"When Enabled, rim light is generated only in the direction of the light source.");
|
||||||
|
|
||||||
|
public static readonly GUIContent lightDirectionRimLightLevelText =
|
||||||
|
new("Light Direction Rim Light Level",
|
||||||
|
"Specifies intensity of Rim Light in the light source direction,");
|
||||||
|
|
||||||
|
public static readonly GUIContent invertedDirectionRimLightText =
|
||||||
|
new("Inverted Direction Rim Light", "Rim light from inverted/antipodean direction.");
|
||||||
|
|
||||||
|
public static readonly GUIContent invertedRimLightColorText =
|
||||||
|
new("Inverted Rim Light Color", "Specifies the color of inverted/antipodean rim light.");
|
||||||
|
|
||||||
|
public static readonly GUIContent inversedRimLightLevelText =
|
||||||
|
new("Inversed Rim Light Level", "Specifies Inverted/Antipodean Rim Light Level.");
|
||||||
|
|
||||||
|
public static readonly GUIContent invertedRimLightFeatherOffText =
|
||||||
|
new("Inverted Rim Light Feather Off", "Disable Inverted Rim light feather.");
|
||||||
|
|
||||||
|
public static readonly GUIContent rimLightMaskMapText = new("Rim Light Mask",
|
||||||
|
"Rim Light Mask : Texture(linear). The white part of the texture is displayed as Rim Light, and the black part is masked and not displayed.");
|
||||||
|
|
||||||
|
public static readonly GUIContent rimLightMaskLevelText =
|
||||||
|
new("Rim Light Mask Level",
|
||||||
|
"-1 gives 0% for the Rim Light effect, 0 gives 100% for the Rim Light and Mask effect, 1 gives 100% for the Rim Light and 0% for the Mask effect.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LoadMaterialProperties()
|
||||||
|
{
|
||||||
|
Properties.rimLightEnabled = FindProperty("_RimLight");
|
||||||
|
Properties.rimLightColor = FindProperty("_RimLightColor");
|
||||||
|
Properties.rimLightStrength = FindProperty("_RimLight_Strength");
|
||||||
|
Properties.rimLightLevel = FindProperty("_RimLight_Power");
|
||||||
|
Properties.colorBlendingMode = FindProperty("_Is_BlendAddToRimColor");
|
||||||
|
Properties.adjustRimLightArea = FindProperty("_RimLight_InsideMask");
|
||||||
|
Properties.rimLightFeatherOff = FindProperty("_RimLight_FeatherOff");
|
||||||
|
Properties.lightDirection = FindProperty("_LightDirection_MaskOn");
|
||||||
|
Properties.lightDirectionRimLightLevel = FindProperty("_Tweak_LightDirection_MaskLevel");
|
||||||
|
Properties.invertedDirectionRimLight = FindProperty("_Add_Antipodean_RimLight");
|
||||||
|
Properties.invertedRimLightColor = FindProperty("_Ap_RimLightColor");
|
||||||
|
Properties.inversedRimLightLevel = FindProperty("_Ap_RimLight_Power");
|
||||||
|
Properties.invertedRimLightFeatherOff = FindProperty("_Ap_RimLight_FeatherOff");
|
||||||
|
Properties.rimLightMaskMap = FindProperty("_Set_RimLightMask");
|
||||||
|
Properties.rimLightMaskLevel = FindProperty("_Tweak_RimLightMaskLevel");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DrawContent()
|
||||||
|
{
|
||||||
|
editor.ShaderProperty(Properties.rimLightEnabled, Styles.rimLightEnabledText);
|
||||||
|
EditorGUI.BeginDisabledGroup(Properties.rimLightEnabled.floatValue == 0);
|
||||||
|
{
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
editor.ShaderProperty(Properties.rimLightColor, Styles.rimLightColorText);
|
||||||
|
editor.ShaderProperty(Properties.rimLightStrength, Styles.rimLightStrengthText);
|
||||||
|
editor.ShaderProperty(Properties.rimLightLevel, Styles.rimLightLevelText);
|
||||||
|
editor.ShaderProperty(Properties.colorBlendingMode, Styles.colorBlendingModeText);
|
||||||
|
editor.ShaderProperty(Properties.adjustRimLightArea, Styles.adjustRimLightAreaText);
|
||||||
|
editor.ShaderProperty(Properties.rimLightFeatherOff, Styles.rimLightFeatherOffText);
|
||||||
|
editor.ShaderProperty(Properties.lightDirection, Styles.lightDirectionText);
|
||||||
|
EditorGUI.BeginDisabledGroup(Properties.lightDirection.floatValue == 0);
|
||||||
|
{
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
editor.ShaderProperty(Properties.lightDirectionRimLightLevel,
|
||||||
|
Styles.lightDirectionRimLightLevelText);
|
||||||
|
editor.ShaderProperty(Properties.invertedDirectionRimLight,
|
||||||
|
Styles.invertedDirectionRimLightText);
|
||||||
|
EditorGUI.BeginDisabledGroup(Properties.invertedDirectionRimLight.floatValue == 0);
|
||||||
|
{
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
editor.ShaderProperty(Properties.invertedRimLightColor, Styles.invertedRimLightColorText);
|
||||||
|
editor.ShaderProperty(Properties.inversedRimLightLevel, Styles.inversedRimLightLevelText);
|
||||||
|
editor.ShaderProperty(Properties.invertedRimLightFeatherOff,
|
||||||
|
Styles.invertedRimLightFeatherOffText);
|
||||||
|
}
|
||||||
|
EditorGUI.EndDisabledGroup();
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
EditorGUI.EndDisabledGroup();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
editor.TexturePropertySingleLine(Styles.rimLightMaskMapText, Properties.rimLightMaskMap);
|
||||||
|
editor.ShaderProperty(Properties.rimLightMaskLevel, Styles.rimLightMaskLevelText);
|
||||||
|
}
|
||||||
|
EditorGUI.EndDisabledGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.Rimlight;
|
||||||
|
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Rim Light Settings");
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Editor/MeterialEditor/UIScopes/RimLightScope.cs.meta
Normal file
3
Editor/MeterialEditor/UIScopes/RimLightScope.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c18934f763fe4f3cb5e6f02599209764
|
||||||
|
timeCreated: 1738311777
|
||||||
@@ -26,6 +26,7 @@ namespace Misaki.HdrpToon.Editor
|
|||||||
{
|
{
|
||||||
AddUIScope(new SurfaceOptionsScope());
|
AddUIScope(new SurfaceOptionsScope());
|
||||||
AddUIScope(new ShadingColorScope());
|
AddUIScope(new ShadingColorScope());
|
||||||
|
AddUIScope(new RimLightScope());
|
||||||
AddUIScope(new AngelRingScope());
|
AddUIScope(new AngelRingScope());
|
||||||
AddUIScope(new OutlineScope());
|
AddUIScope(new OutlineScope());
|
||||||
|
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ Shader "HDRP/Toon"
|
|||||||
_HighColor_Power("HighColor_Power", Range(0, 1)) = 0
|
_HighColor_Power("HighColor_Power", Range(0, 1)) = 0
|
||||||
[Toggle(_)] _Is_SpecularToHighColor("Is_SpecularToHighColor", Float) = 0
|
[Toggle(_)] _Is_SpecularToHighColor("Is_SpecularToHighColor", Float) = 0
|
||||||
[Toggle(_)] _Is_BlendAddToHiColor("Is_BlendAddToHiColor", Float) = 0
|
[Toggle(_)] _Is_BlendAddToHiColor("Is_BlendAddToHiColor", Float) = 0
|
||||||
[Toggle(_)] _Is_BlendAddToRimColor("Is_BlendAddToRimColor", Float) = 1
|
[Enum(Multiply,0, Add,1)] _Is_BlendAddToRimColor("Is_BlendAddToRimColor", Float) = 1
|
||||||
[Toggle(_)] _Is_UseTweakHighColorOnShadow("Is_UseTweakHighColorOnShadow", Float) = 0
|
[Toggle(_)] _Is_UseTweakHighColorOnShadow("Is_UseTweakHighColorOnShadow", Float) = 0
|
||||||
_TweakHighColorOnShadow("TweakHighColorOnShadow", Range(0, 1)) = 0
|
_TweakHighColorOnShadow("TweakHighColorOnShadow", Range(0, 1)) = 0
|
||||||
//HiColorMask
|
//HiColorMask
|
||||||
|
|||||||
Reference in New Issue
Block a user