From bee103e89fc83030bfc0251db5a78bb153042e1f Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 17 Jan 2025 01:13:49 -0800 Subject: Use quad intrinsics to compute trochoid normals Simple algo. Use quad intrinsics to get neighboring pixels' (x & y) positions in trochoid space. Compute tangent and bitangent from that. Then normal as cross product. There's some artifacting on diagonal boundaries. --- Editor/tooner.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Editor') diff --git a/Editor/tooner.cs b/Editor/tooner.cs index 0d15a3a..310cfa6 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -1990,6 +1990,13 @@ public class ToonerGUI : ShaderGUI { bc = FindProperty("_Trochoid_Height_Scale"); FloatProperty(bc, "Height scale"); + bc = FindProperty("_Trochoid_Enable_Fragment_Normals"); + enabled = (bc.floatValue != 0.0); + EditorGUI.BeginChangeCheck(); + enabled = Toggle("Enable fragment normals", enabled); + EditorGUI.EndChangeCheck(); + bc.floatValue = enabled ? 1.0f : 0.0f; + EditorGUI.indentLevel -= 1; } -- cgit v1.2.3