Files
Ipseity-Demo/Assets/_Content/Scripts/Editor/ToonBilalEditor.cs
T

77 lines
5.4 KiB
C#

// Place this file inside an Editor/ folder in your project
using UnityEditor;
using UnityEngine;
public class ToonBilalEditor : ShaderGUI
{
static readonly System.Collections.Generic.Dictionary<string, string> tooltips = new()
{
{ "_ToonEnabled", "Enables or disables the entire toon filter. When off, the original image is returned with no processing." },
{ "_ShaderWeight", "Global blend weight of the shader. 0 = original image, 1 = full effect." },
{ "_ToonSteps", "Number of brightness bands. 2 = very graphic, 6+ = nearly smooth." },
{ "_ShadowStrength", "Brightness of shadow areas. Lower = darker, moodier shadows like Bilal." },
{ "_HighlightBoost", "Multiplier applied to bright areas. Higher = near-white blown-out highlights like Bilal's lit zones." },
{ "_HighlightThreshold", "Brightness level above which highlights get blown out. Lower = more surfaces affected." },
{ "_OutlineThickness", "Base outline thickness in pixels." },
{ "_OutlineThicknessVar", "World-space random thickness variation. 0 = uniform, 1 = organic hand-drawn look." },
{ "_DepthThreshold", "Depth outline detection threshold in meters (linearized). Higher = only detects strong silhouettes, ignores polygon edges." },
{ "_ColorThreshold", "Color outline detection threshold. Lower = more outlines detected." },
{ "_DepthOutlineStrength", "Strength of depth-detected outlines (silhouettes, geometric edges)." },
{ "_ColorOutlineStrength", "Strength of color-detected outlines (material changes)." },
{ "_OutlineSoftness", "Blends between thin (0) and thick soft (1) outlines." },
{ "_OutlineColorBlend", "How much surface color bleeds into the outline. 0 = black, 1 = colored." },
{ "_OutlineDarken", "Darkens the surface color for the outline. 1 = fully black." },
{ "_OutlineDistanceFade", "Distance in meters at which outlines fully fade out. Prevents polygon edges from showing on distant geometry." },
{ "_OutlineFadeStart", "Brightness at which outlines start fading on bright surfaces." },
{ "_OutlineFadeEnd", "Brightness at which outlines are fully gone on bright surfaces." },
{ "_OutlineFadeStrength", "Strength of outline fade on bright areas." },
{ "_OutlineBrightMin", "Minimum outline visibility even on very bright surfaces." },
{ "_HatchTex", "Hatching texture (black strokes on white). Use a pencil or pen texture." },
{ "_HatchScale", "World-space scale of hatching layer 1." },
{ "_HatchStrength", "Global hatching intensity. 0 = none, 1 = full." },
{ "_HatchThreshold", "Shadow threshold for hatching. Higher = hatching only in darkest zones." },
{ "_CurvatureStrength", "Amplifies detected curvature. Higher = more hatching on rounded surfaces." },
{ "_FlatSurface", "Minimum hatching on flat surfaces. 0 = flat surfaces fully hatched too." },
{ "_HatchScale2", "Scale of cross-hatch layer 2, rotated to a different angle." },
{ "_HatchScale3", "Scale of third hatch layer, used in very dark and curved zones." },
{ "_HatchRotation", "Rotation angle in radians between hatch layers. 0.785 ≈ 45°." },
{ "_HatchLayerBlend", "Base blend toward cross-hatch. Increases automatically in darker zones." },
{ "_HatchOrganicNoise", "Organic deformation via FBM noise. 0 = rigid, 1 = wavy hand-drawn." },
{ "_HatchOrganicScale", "Scale of organic deformation noise." },
{ "_HatchDensityCurve", "Density curve shape. Lower = wider shadow coverage." },
{ "_TriplanarSharpness", "Sharpness of triplanar projection blending." },
{ "_HatchColorBlend", "Surface color blend into hatching. 0 = black strokes, 1 = colored strokes." },
{ "_HatchDarken", "Darkens surface color for hatching strokes." },
{ "_HatchGrainScale", "Scale of world-space paper grain on hatching." },
{ "_HatchGrainStrength", "Strength of paper grain blended into hatching." },
{ "_HatchPressure", "Simulated pen pressure variation. 0 = uniform, 1 = irregular." },
{ "_BrushTex", "Brush texture for gouache shadow areas." },
{ "_GouacheScale", "World-space scale of gouache brush texture." },
{ "_GouacheStrength", "Strength of gouache effect in shadow areas." },
{ "_GouacheThreshold", "Brightness below which gouache activates." },
{ "_GouacheSaturation", "Saturation boost in gouache areas. >1 = richer colors." },
{ "_GouachePosterize", "Posterization steps for gouache. 1 = flat, 6 = continuous." },
{ "_GouacheBlend", "Blend between hatching and gouache in dark zones." },
};
public override void OnGUI(MaterialEditor editor, MaterialProperty[] props)
{
foreach (var prop in props)
{
string tooltip = tooltips.ContainsKey(prop.name) ? tooltips[prop.name] : prop.displayName;
GUIContent label = new GUIContent(prop.displayName, tooltip);
editor.ShaderProperty(prop, label);
}
EditorGUILayout.Space();
editor.RenderQueueField();
editor.EnableInstancingField();
}
}