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. --- math.cginc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'math.cginc') diff --git a/math.cginc b/math.cginc index 5b33edf..507ca74 100644 --- a/math.cginc +++ b/math.cginc @@ -249,8 +249,8 @@ bool solveQuadratic(float a, float b, float c, out float x0, out float x1) float determinant(float3x3 m) { - return m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) - - m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) + return (m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) + - m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])) + m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]); } -- cgit v1.2.3