summaryrefslogtreecommitdiffstats
path: root/Editor
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-07-15 13:53:48 -0700
committeryum <yum.food.vr@gmail.com>2024-07-15 13:53:48 -0700
commit65960b924a861f273b72157456aabaa694831976 (patch)
tree26ae1b61e1581e5754843e70f785dda6bf4761a0 /Editor
parent09de70448b051e20fbfbd56ee00b24168bdd90ab (diff)
Add filament-style clearcoat
Diffstat (limited to 'Editor')
-rw-r--r--Editor/tooner.cs86
1 files changed, 23 insertions, 63 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs
index adc0fca..2c02896 100644
--- a/Editor/tooner.cs
+++ b/Editor/tooner.cs
@@ -98,6 +98,24 @@ public class ToonerGUI : ShaderGUI {
SetKeyword("_ROUGHNESS_MAP", bct.textureValue);
}
+ void DoClearcoat() {
+ MaterialProperty bc;
+ bc = FindProperty("_Clearcoat_Enabled");
+ bool enabled = bc.floatValue > 1E-6;
+ EditorGUI.BeginChangeCheck();
+ enabled = EditorGUILayout.Toggle("Enable clearcoat", enabled);
+ EditorGUI.EndChangeCheck();
+ bc.floatValue = enabled ? 1.0f : 0.0f;
+ SetKeyword("_CLEARCOAT", enabled);
+
+ if (enabled) {
+ bc = FindProperty("_Clearcoat_Strength");
+ editor.RangeProperty(bc, "Strength");
+ bc = FindProperty("_Clearcoat_Roughness");
+ editor.RangeProperty(bc, "Roughness");
+ }
+ }
+
enum PbrAlbedoMixMode {
AlphaBlend,
Add,
@@ -1028,55 +1046,9 @@ public class ToonerGUI : ShaderGUI {
void DoMochieParams() {
MaterialProperty bc;
- GUILayout.Label("SSS", EditorStyles.boldLabel);
- {
- EditorGUI.indentLevel += 1;
- bc = FindProperty("_ScatterDist");
- editor.FloatProperty(bc, "Distance");
- bc = FindProperty("_ScatterPow");
- editor.FloatProperty(bc, "Power");
- bc = FindProperty("_ScatterIntensity");
- editor.FloatProperty(bc, "Intensity");
- bc = FindProperty("_ScatterAmbient");
- editor.FloatProperty(bc, "Ambient");
- EditorGUI.indentLevel -= 1;
- }
- GUILayout.Label("SSR", EditorStyles.boldLabel);
- {
- EditorGUI.indentLevel += 1;
-
- bc = FindProperty("_Enable_SSR");
- bool enabled = (bc.floatValue != 0.0);
- EditorGUI.BeginChangeCheck();
- enabled = EditorGUILayout.Toggle("Enable SSR", enabled);
- EditorGUI.EndChangeCheck();
- bc.floatValue = enabled ? 1.0f : 0.0f;
- SetKeyword("SSR_ENABLED", enabled);
-
- if (enabled) {
- bc = FindProperty("_SSRStrength");
- editor.FloatProperty(bc, "Strength");
- bc = FindProperty("_SSRHeight");
- editor.FloatProperty(bc, "Height");
- bc = FindProperty("_EdgeFade");
- editor.FloatProperty(bc, "Edge fade");
- }
- EditorGUI.indentLevel -= 1;
- }
- GUILayout.Label("GSAA", EditorStyles.boldLabel);
- {
- EditorGUI.indentLevel += 1;
- bc = FindProperty("_GSAA");
- editor.FloatProperty(bc, "Enable");
- bc = FindProperty("_GSAAStrength");
- editor.FloatProperty(bc, "Strength");
- EditorGUI.indentLevel -= 1;
- }
bc = FindProperty("_WrappingFactor");
editor.FloatProperty(bc, "Wrapping factor");
- bc = FindProperty("_Subsurface");
- editor.FloatProperty(bc, "Subsurface");
bc = FindProperty("_SpecularStrength");
editor.FloatProperty(bc, "Specular strength");
bc = FindProperty("_FresnelStrength");
@@ -1085,23 +1057,6 @@ public class ToonerGUI : ShaderGUI {
editor.FloatProperty(bc, "Use fresnel");
bc = FindProperty("_ReflectionStrength");
editor.FloatProperty(bc, "Reflection strength");
- /*
-float _ScatterDist;
-float _ScatterPow;
-float _ScatterIntensity;
-float _ScatterAmbient;
-float _GSAA;
-float _GSAAStrength;
-float _WrappingFactor;
-float _Subsurface;
-float _SpecularStrength;
-float _FresnelStrength;
-float _UseFresnel;
-float _ReflectionStrength;
-float3 shadowedReflections;
-float3 _ReflShadows;
-float3 _ReflShadowStrength;
-*/
}
enum RenderingMode {
@@ -1300,6 +1255,11 @@ float3 _ReflShadowStrength;
DoPBROverlay();
+ GUILayout.Label("Clearcoat", EditorStyles.boldLabel);
+ EditorGUI.indentLevel += 1;
+ DoClearcoat();
+ EditorGUI.indentLevel -= 1;
+
DoDecal();
GUILayout.Label("Lighting", EditorStyles.boldLabel);