From 35ccb08590b59d545f3e950200f94799791403ae Mon Sep 17 00:00:00 2001 From: Iliya Katueshenock Date: Mon, 10 Jun 2024 21:26:47 +0200 Subject: [PATCH] Fix: Geometry Nodes: handle sheared matrices in mixing more gracefully This fix of the assertion related with using `Combine Matrix` and `Sample UV` nodes in some simple cases. Pull Request: https://projects.blender.org/blender/blender/pulls/122958 --- source/blender/blenkernel/intern/attribute_math.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/attribute_math.cc b/source/blender/blenkernel/intern/attribute_math.cc index a9509101059..a62a723e7a3 100644 --- a/source/blender/blenkernel/intern/attribute_math.cc +++ b/source/blender/blenkernel/intern/attribute_math.cc @@ -3,6 +3,7 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ #include "BLI_array_utils.hh" +#include "BLI_math_euler.hh" #include "BLI_math_matrix.hh" #include "BLI_math_quaternion.hh" @@ -47,7 +48,10 @@ float4x4 mix3(const float3 &weights, const float4x4 &v0, const float4x4 &v1, con { const float3 location = mix3(weights, v0.location(), v1.location(), v2.location()); const math::Quaternion rotation = mix3( - weights, math::to_quaternion(v0), math::to_quaternion(v1), math::to_quaternion(v2)); + weights, + math::normalized_to_quaternion_safe(math::normalize(float3x3(v0))), + math::normalized_to_quaternion_safe(math::normalize(float3x3(v1))), + math::normalized_to_quaternion_safe(math::normalize(float3x3(v2)))); const float3 scale = mix3(weights, math::to_scale(v0), math::to_scale(v1), math::to_scale(v2)); return math::from_loc_rot_scale(location, rotation, scale); }