Added new stocking scope to shader gui;

Added new stocking surface feature;
Added unity 6.3 support;

Fixed the issue that ssr weight does not blend ibl and ssr properly;
Fixed the issue that material recive ssr regardless of specular ambient mode;
This commit is contained in:
2025-08-17 13:10:38 +09:00
parent aeb4da48eb
commit 973f617590
27 changed files with 196 additions and 142 deletions

View File

@@ -5,20 +5,14 @@ namespace Misaki.HdrpToon.Editor
SurfaceOptions = 1 << 0,
ShadingColor = 1 << 1,
Shadow = 1 << 2,
MaterialFeature = 1 << 3,
SurfaceInputs = 1 << 4,
Ambient = 1 << 5,
Highlight = 1 << 6,
Rimlight = 1 << 7,
MatCap = 1 << 8,
Stocking = 1 << 9,
AngelRing = 1 << 10,
Emission = 1 << 11,
Outline = 1 << 12,
TessellationHDRP = 1 << 13,
SceneLight = 1 << 14,
EnvironmentalLightEffectiveness = 1 << 15,
MetaverseSettings = 1 << 16,
Advance = 1 << 17,
SurfaceInputs = 1 << 3,
Ambient = 1 << 4,
// Surface Features
AngelRing = 1 << 5,
Rimlight = 1 << 6,
Stocking = 1 << 7,
Outline = 1 << 8,
Advance = 1 << 9,
}
}
}

View File

@@ -6,7 +6,7 @@ using static Misaki.HdrpToon.UTSPropertyName.Advance;
namespace Misaki.HdrpToon.Editor
{
public class AdvanceScope : MaterialUIScope<ShaderGUIExpandable>
internal class AdvanceScope : MaterialUIScope<ShaderGUIExpandable>
{
private static class Properties
{
@@ -32,7 +32,7 @@ namespace Misaki.HdrpToon.Editor
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Advance Settings");
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
Properties.diffuseMin = FindProperty(MINIMAL_DIFFUSE_CONTRIBUTION);

View File

@@ -4,7 +4,7 @@ using UnityEngine;
namespace Misaki.HdrpToon.Editor
{
public class AmbientScope : MaterialUIScope<ShaderGUIExpandable>
internal class AmbientScope : MaterialUIScope<ShaderGUIExpandable>
{
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.Ambient;
protected override GUIContent Header => new("Ambient Settings");
@@ -52,7 +52,7 @@ namespace Misaki.HdrpToon.Editor
public static readonly GUIContent ssrWeightText = new("SSR Weight", "SSR Weight");
}
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
Properties.indirectDiffuseMode = FindProperty("_Indirect_Diffuse_Mode");
Properties.indirectSpecularMode = FindProperty("_Indirect_Specular_Mode");

View File

@@ -32,7 +32,7 @@ namespace Misaki.HdrpToon.Editor
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Angel Ring Settings");
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
Properties.angelRingColor = FindProperty(ANGEL_RING_COLOR);
Properties.angelRingColorMap = FindProperty(ANGEL_RING_COLOR_MAP);

View File

@@ -48,7 +48,7 @@ namespace Misaki.HdrpToon.Editor
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Outline Settings");
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
Properties.outlineState = FindProperty(OUTLINE_STATE);

View File

@@ -7,7 +7,7 @@ using static Misaki.HdrpToon.UTSPropertyName.RimLight;
namespace Misaki.HdrpToon.Editor
{
public class RimLightScope : MaterialUIScope<ShaderGUIExpandable>
internal class RimLightScope : MaterialUIScope<ShaderGUIExpandable>
{
private static class Properties
{
@@ -43,7 +43,7 @@ namespace Misaki.HdrpToon.Editor
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Rim Light Settings");
protected override bool ShowSection => materials.All(mat => mat.HasFeature(SurfaceFeature.RimLight));
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
Properties.rimLightColor = FindProperty(RIM_LIGHT_COLOR);
Properties.rimLightIntensity = FindProperty(RIM_LIGHT_INTENSITY);

View File

@@ -5,7 +5,7 @@ using UnityEngine;
namespace Misaki.HdrpToon.Editor
{
public class ShadingColorScope : MaterialUIScope<ShaderGUIExpandable>
internal class ShadingColorScope : MaterialUIScope<ShaderGUIExpandable>
{
private static class Properties
{
@@ -85,7 +85,7 @@ namespace Misaki.HdrpToon.Editor
}
}
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
Properties.shadingRampMapState = FindProperty("_Use_Shading_Ramp_Map");

View File

@@ -30,7 +30,7 @@ namespace Misaki.HdrpToon.Editor
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Shadow Settings");
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
Properties.receiveLightShadow = FindProperty("_Receive_Light_Shadow");
Properties.receiveScreenSpaceShadow = FindProperty("_Receive_Screen_Space_Shadow");

View File

@@ -1,22 +1,51 @@
using Misaki.ShaderGUI;
using UnityEditor;
using UnityEngine;
using static Misaki.HdrpToon.UTSPropertyName.Stocking;
namespace Misaki.HdrpToon.Editor
{
public class StockingScope : MaterialUIScope<ShaderGUIExpandable>
internal class StockingScope : MaterialUIScope<ShaderGUIExpandable>
{
private static class Properties
{
public static MaterialProperty stockingFresnelWidth;
public static MaterialProperty stockingSparkleSpacing;
public static MaterialProperty stockingSparkleAmount;
public static MaterialProperty stockingSparkleSize;
public static MaterialProperty stockingSparkleIntensity;
}
private static class Styles
{
public static readonly GUIContent stockingFresnelWidthText = new("Fresnel Width", "Set the width of the fresnel effect for the stocking.");
public static readonly GUIContent stockingSparkleSpacingText = new("Sparkle Spacing", "Set the spacing between sparkles on the stocking.");
public static readonly GUIContent stockingSparkleAmountText = new("Sparkle Amount", "Set the amount of sparkles on the stocking.");
public static readonly GUIContent stockingSparkleSizeText = new("Sparkle Size", "Set the size of the sparkles on the stocking.");
public static readonly GUIContent stockingSparkleIntensityText = new("Sparkle Intensity", "Set the intensity of the sparkle effect for the stocking.");
}
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.Stocking;
protected override GUIContent Header => throw new System.NotImplementedException();
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Stocking Settings");
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
throw new System.NotImplementedException();
Properties.stockingFresnelWidth = FindProperty(STOCKING_FRESNEL_WIDTH);
Properties.stockingSparkleSpacing = FindProperty(STOCKING_SPARKLE_SPACING);
Properties.stockingSparkleAmount = FindProperty(STOCKING_SPARKLE_AMOUNT);
Properties.stockingSparkleSize = FindProperty(STOCKING_SPARKLE_SIZE);
Properties.stockingSparkleIntensity = FindProperty(STOCKING_SPARKLE_INTENSITY);
}
protected override void DrawContent()
{
throw new System.NotImplementedException();
editor.ShaderProperty(Properties.stockingFresnelWidth, Styles.stockingFresnelWidthText);
editor.ShaderProperty(Properties.stockingSparkleSpacing, Styles.stockingSparkleSpacingText);
editor.ShaderProperty(Properties.stockingSparkleAmount, Styles.stockingSparkleAmountText);
editor.ShaderProperty(Properties.stockingSparkleSize, Styles.stockingSparkleSizeText);
editor.ShaderProperty(Properties.stockingSparkleIntensity, Styles.stockingSparkleIntensityText);
}
}
}
}

View File

@@ -8,7 +8,7 @@ using static Misaki.HdrpToon.UTSPropertyName.SurfaceInputs;
namespace Misaki.HdrpToon.Editor
{
public class SurfaceInputsScope : MaterialUIScope<ShaderGUIExpandable>
internal class SurfaceInputsScope : MaterialUIScope<ShaderGUIExpandable>
{
private static class Properties
{
@@ -75,7 +75,7 @@ namespace Misaki.HdrpToon.Editor
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.SurfaceInputs;
protected override GUIContent Header => new("Surface Inputs");
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
Properties.normalMap = FindProperty("_NormalMap");
Properties.normalMapScale = FindProperty("_NormalScale");

View File

@@ -61,7 +61,7 @@ namespace Misaki.HdrpToon.Editor
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Surface Options");
public override void LoadMaterialProperties()
protected override void LoadMaterialProperties()
{
Properties.surfaceType = FindProperty(SURFACE_TYPE);

View File

@@ -31,15 +31,19 @@ namespace Misaki.HdrpToon.Editor
private void OnInitialize(MaterialEditor materialEditor, MaterialProperty[] properties)
{
AddUIScope(new SurfaceOptionsScope());
AddUIScope(new ShadingColorScope());
AddUIScope(new ShadowScope());
AddUIScope(new SurfaceInputsScope());
AddUIScope(new AmbientScope());
AddUIScope(new RimLightScope());
AddUIScope(new AngelRingScope());
AddUIScope(new OutlineScope());
AddUIScope(new AdvanceScope());
AddUIScope<SurfaceOptionsScope>();
AddUIScope<ShadingColorScope>();
AddUIScope<ShadowScope>();
AddUIScope<SurfaceInputsScope>();
AddUIScope<AmbientScope>();
// Surface Features
AddUIScope<AngelRingScope>();
AddUIScope<RimLightScope>();
AddUIScope<StockingScope>();
AddUIScope<OutlineScope>();
AddUIScope<AdvanceScope>();
Initialize(materialEditor, properties);