summaryrefslogtreecommitdiffstats
path: root/Editor/tooner.cs
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-07-13 16:33:25 -0700
committeryum <yum.food.vr@gmail.com>2024-07-13 16:33:25 -0700
commit3dcb2fd0e240f3c0141e65c32bc2c4a7f8e9fd20 (patch)
tree3972c678d7f01022a31c6eadffc1dcff50c9f83c /Editor/tooner.cs
parentbf4457b96cd46ed2d3d61bde2eb4d58d3114730b (diff)
Integration pixellation and trochoid shaders
Trochoid is a WIP. Need to do some magic to make it properly shear. In short: it's currently implemented as a standalone Mesh Renderer object which I place on my avatar's neck bone. Since its object origin is not at the hip bone like everything else, it behaves weirdly when shearing. Solution is to implement it as a regular skinned mesh renderer. Requires some careful analysis to get right.
Diffstat (limited to 'Editor/tooner.cs')
-rw-r--r--Editor/tooner.cs74
1 files changed, 74 insertions, 0 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs
index 23a93ef..ba45a5d 100644
--- a/Editor/tooner.cs
+++ b/Editor/tooner.cs
@@ -916,6 +916,24 @@ public class ToonerGUI : ShaderGUI {
bc = FindProperty("_Gimmick_Shear_Location_Strength");
editor.VectorProperty(bc, "Strength");
+ bc = FindProperty("_Gimmick_Shear_Location_Mesh_Renderer_Fix");
+ enabled = (bc.floatValue != 0.0);
+ EditorGUI.BeginChangeCheck();
+ enabled = EditorGUILayout.Toggle("Mesh renderer fix", enabled);
+ EditorGUI.EndChangeCheck();
+ bc.floatValue = enabled ? 1.0f : 0.0f;
+
+ if (enabled) {
+ EditorGUI.indentLevel += 1;
+ bc = FindProperty("_Gimmick_Shear_Location_Mesh_Renderer_Offset");
+ editor.VectorProperty(bc, "Offset");
+ bc = FindProperty("_Gimmick_Shear_Location_Mesh_Renderer_Rotation");
+ editor.VectorProperty(bc, "Rotation");
+ bc = FindProperty("_Gimmick_Shear_Location_Mesh_Renderer_Scale");
+ editor.VectorProperty(bc, "Scale");
+ EditorGUI.indentLevel -= 1;
+ }
+
EditorGUI.indentLevel -= 1;
}
@@ -943,12 +961,68 @@ public class ToonerGUI : ShaderGUI {
EditorGUI.indentLevel -= 1;
}
+ void DoGimmickPixellate() {
+ MaterialProperty bc;
+ bc = FindProperty("_Gimmick_Pixellate_Enable_Static");
+ bool enabled = (bc.floatValue != 0.0);
+ EditorGUI.BeginChangeCheck();
+ enabled = EditorGUILayout.Toggle("Pixellate", enabled);
+ EditorGUI.EndChangeCheck();
+ bc.floatValue = enabled ? 1.0f : 0.0f;
+ SetKeyword("_PIXELLATE", enabled);
+
+ if (!enabled) {
+ return;
+ }
+
+ EditorGUI.indentLevel += 1;
+
+ bc = FindProperty("_Gimmick_Pixellate_Resolution_U");
+ editor.FloatProperty(bc, "Resolution (U)");
+ bc = FindProperty("_Gimmick_Pixellate_Resolution_V");
+ editor.FloatProperty(bc, "Resolution (V)");
+ bc = FindProperty("_Gimmick_Pixellate_Effect_Mask");
+ editor.TexturePropertySingleLine(
+ MakeLabel(bc, "Effect mask"),
+ bc);
+
+ EditorGUI.indentLevel -= 1;
+ }
+
+ void DoGimmickTrochoid() {
+ MaterialProperty bc;
+ bc = FindProperty("_Trochoid_Enable_Static");
+ bool enabled = (bc.floatValue != 0.0);
+ EditorGUI.BeginChangeCheck();
+ enabled = EditorGUILayout.Toggle("Trochoid", enabled);
+ EditorGUI.EndChangeCheck();
+ bc.floatValue = enabled ? 1.0f : 0.0f;
+ SetKeyword("_TROCHOID", enabled);
+
+ if (!enabled) {
+ return;
+ }
+
+ EditorGUI.indentLevel += 1;
+
+ bc = FindProperty("_Trochoid_R");
+ editor.FloatProperty(bc, "R");
+ bc = FindProperty("_Trochoid_r");
+ editor.FloatProperty(bc, "r");
+ bc = FindProperty("_Trochoid_d");
+ editor.FloatProperty(bc, "d");
+
+ EditorGUI.indentLevel -= 1;
+ }
+
void DoGimmicks() {
DoGimmickFlatColor();
DoGimmickQuantizeLocation();
DoGimmickShearLocation();
DoGimmickEyes00();
+ DoGimmickPixellate();
+ DoGimmickTrochoid();
}
enum RenderingMode {