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; }