From e774cc66635b493384142033ab52095ed1881e0a Mon Sep 17 00:00:00 2001 From: rsformoso Date: Fri, 20 Mar 2026 23:55:40 +0800 Subject: [PATCH] Add minimum splat size to GetMajorAxes --- Assets/vfx-graph-gs/VFXGraphHLSL/GetMajorAxes.hlsl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Assets/vfx-graph-gs/VFXGraphHLSL/GetMajorAxes.hlsl b/Assets/vfx-graph-gs/VFXGraphHLSL/GetMajorAxes.hlsl index 9125da6..29de923 100644 --- a/Assets/vfx-graph-gs/VFXGraphHLSL/GetMajorAxes.hlsl +++ b/Assets/vfx-graph-gs/VFXGraphHLSL/GetMajorAxes.hlsl @@ -1,3 +1,5 @@ +#define EPSILON 0.0004f + /// Hidden float CrossProduct(float2 A, float2 B) { @@ -42,5 +44,15 @@ float4x4 GetMajorAxes(float4x4 Axes, float4x4 AxesProjections) result[1].xyz = z_axes; } + if (length(result[0].xyz) < 0.0004) + { + result[0].xyz = normalize(result[0].xyz) * EPSILON; + } + + if (length(result[1].xyz) < 0.0004) + { + result[1].xyz = normalize(result[1].xyz) * EPSILON; + } + return result; }