Added UtsEvaluateBSDF_MatCapDiffuse;

Added UtsEvaluateBSDF_MatCapSpecular;
This commit is contained in:
Misaki
2025-01-24 17:59:40 +09:00
parent 476fdc3774
commit fac66d8694
9 changed files with 307 additions and 299 deletions

View File

@@ -105,10 +105,10 @@ namespace UnityEditor.Rendering.Toon
internal const string ShaderProp_Outline_Sampler = "_Outline_Sampler";
internal const string ShaderPropCastHairShadow = "_Is_CastHairShadow";
internal const string ShaderPropReceiveHairShadow = "_Is_ReceiveHairShadow";
internal const string ShaderPropReceiveHairShadow = "_Receive_Hair_Shadow";
internal const string ShaderPropEyeParallax = "_Is_EyeParallax";
internal const string ShaderPropHairBlendingTarget = "_Is_HairBlendingTarget";
internal const string ShaderPropHairBlendingTarget = "_HairBlendingTarget";
internal const string ShaderPropSimpleUI = "_simpleUI";
internal const string ShaderPropAutoRenderQueue = "_AutoRenderQueue";
@@ -214,10 +214,10 @@ namespace UnityEditor.Rendering.Toon
protected readonly string[] StencilModeNames = { "Off", "Draw If Not Equal to", "Replace Stencil Buffer with" };
protected readonly string[] ZTestModeNames = { "Disabled", "Never", "Less", "Equal", "LessEqual", "Greater", "NotEqual", "GreaterEqual", "Always" };
protected readonly string[] materialTypeDefines = { "MATERIAL_TYPE_STANDARD", "MATERIAL_TYPE_FRONT_HAIR", "MATERIAL_TYPE_FACE", "MATERIAL_TYPE_EYE" };
protected readonly string[] PbrModeDefines = { "PBR_Mode_OFF", "PBR_Mode_ST", "PBR_Mode_ANISO", "PBR_Mode_KK", "PBR_Mode_TOON" };
protected readonly string[] IndirectDiffuseModeDefines = { "INDIRECT_DIFFUSE_OFF", "INDIRECT_DIFFUSE_IBL", "INDIRECT_DIFFUSE_MATCAP", "INDIRECT_DIFFUSE_RAMP" };
protected readonly string[] IndirectSpecularModeDefines = { "INDIRECT_SPECULAR_OFF", "INDIRECT_SPECULAR_IBL", "INDIRECT_SPECULAR_MATCAP" };
protected readonly string[] materialTypeDefines = { "_MATERIAL_TYPE_STANDARD", "_MATERIAL_TYPE_FRONTHAIR", "_MATERIAL_TYPE_FACE", "_MATERIAL_TYPE_EYE" };
protected readonly string[] PbrModeDefines = { "_PBR_MODE_OFF", "_PBR_MODE_STANDARD", "_PBR_MODE_ANISOTROPY", "_PBR_MODE_HAIR", "_PBR_MODE_TOON" };
protected readonly string[] IndirectDiffuseModeDefines = { "_INDIRECT_DIFFUSE_OFF", "_INDIRECT_DIFFUSE_IBL", "_INDIRECT_DIFFUSE_MATCAP", "_INDIRECT_DIFFUSE_RAMP" };
protected readonly string[] IndirectSpecularModeDefines = { "_INDIRECT_SPECULAR_OFF", "_INDIRECT_SPECULAR_IBL", "_INDIRECT_SPECULAR_MATCAP" };
public enum UTS_ClippingMode
{
@@ -302,7 +302,7 @@ namespace UnityEditor.Rendering.Toon
{
Off, IBL, Matcap, Ramp
}
public enum IndirectSpecularMode
{
Off, IBL, Matcap
@@ -334,7 +334,7 @@ namespace UnityEditor.Rendering.Toon
#if UNITY_2021_1_OR_NEWER
[UTS3InspectorHelpURL("instruction")]
#endif // UNITY_2021_1_OR_NEWER
protected enum Expandable
protected enum Expandable : uint
{
Shader = 1 << 0,
Basic = 1 << 1,
@@ -672,7 +672,8 @@ namespace UnityEditor.Rendering.Toon
public static readonly GUIContent hairBlendingTargetMapText = new GUIContent("Blending Map", "Specifies the texture to blend with hair.");
public static readonly GUIContent normalMapText = new GUIContent("Normal Map", "A texture that dictates the bumpiness of the material.");
public static readonly GUIContent pbrModeText = new GUIContent("PBR Mode", "Specifies PBR model mode.");
public static readonly GUIContent ambientModeModeText = new GUIContent("Ambient Mode", "Specifies ambient calculation mode.");
public static readonly GUIContent indirectDiffuseModeText = new GUIContent("Indirect Diffuse Mode", "Specifies indirect diffuse mode.");
public static readonly GUIContent indirectSpecularText = new GUIContent("Indirect Specular Mode", "Specifies indirect specular mode.");
public static readonly GUIContent highColorText = new GUIContent("Highlight", "Highlight : Texture(sRGB) x Color(RGB) Default:White");
public static readonly GUIContent highColorMaskText = new GUIContent("Highlight Mask", "A grayscale texture which utilizes its brightness to control intensity.");
public static readonly GUIContent rimLightMaskText = new GUIContent("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.");
@@ -1638,7 +1639,7 @@ namespace UnityEditor.Rendering.Toon
var isReceiveHairShadowEnabled = GUI_Toggle(material, Styles.receiveHairShadowText, ShaderPropReceiveHairShadow,
MaterialGetInt(material, ShaderPropReceiveHairShadow) != 0);
material.SetKeyword(new LocalKeyword(material.shader, "_RECEIVE_HAIR_SHADOW"), isReceiveHairShadowEnabled);
material.SetKeyword(new LocalKeyword(material.shader, "_RECEIVE_HAIR_SHADOW_ON"), isReceiveHairShadowEnabled);
var isHairBlendingTargetEnabled = GUI_Toggle(material, Styles.hairBlendingTargetShadowText, ShaderPropHairBlendingTarget,
MaterialGetInt(material, ShaderPropHairBlendingTarget) != 0);
@@ -1680,7 +1681,7 @@ namespace UnityEditor.Rendering.Toon
{
GUI_RangeProperty(material, Styles.eyeParallaxAmount);
}
void SwitchKeywrod(Material material, string targetKeywrod, string[] sources)
{
foreach (var keywrod in sources)
@@ -1817,14 +1818,14 @@ namespace UnityEditor.Rendering.Toon
void GUI_AmbientMode(Material material)
{
m_IndirectDiffuseMode = (IndirectDiffuseMode)MaterialGetInt(material, ShaderPropIDMode);
m_IndirectDiffuseMode = (IndirectDiffuseMode)EditorGUILayout.EnumPopup(Styles.ambientModeModeText, m_IndirectDiffuseMode);
m_IndirectDiffuseMode = (IndirectDiffuseMode)EditorGUILayout.EnumPopup(Styles.indirectDiffuseModeText, m_IndirectDiffuseMode);
material.SetFloat(ShaderPropIDMode, (int)m_IndirectDiffuseMode);
SwitchKeywrod(material, IndirectDiffuseModeDefines[(int)m_IndirectDiffuseMode], IndirectDiffuseModeDefines);
m_IndirectSpecularMode = (IndirectSpecularMode)MaterialGetInt(material, ShaderPropISMode);
m_IndirectSpecularMode = (IndirectSpecularMode)EditorGUILayout.EnumPopup(Styles.ambientModeModeText, m_IndirectSpecularMode);
m_IndirectSpecularMode = (IndirectSpecularMode)EditorGUILayout.EnumPopup(Styles.indirectSpecularText, m_IndirectSpecularMode);
material.SetFloat(ShaderPropISMode, (int)m_IndirectSpecularMode);
SwitchKeywrod(material, IndirectSpecularModeDefines[(int)m_IndirectSpecularMode], IndirectSpecularModeDefines);
}