3
$\begingroup$

I need the inverse of a transform matrix, geometry nodes seems to have abstracted away all the matrix math. Is there an intended workflow I'm missing here?

In the following image I'm pulling in the Location, Rotation and Scale from one object and I want to invert that transform to move an another object into this transform space. Would have made a lot of sense to just have a invert checkbox on the Transform Geometry Node.

Example Network

$\endgroup$
3
  • $\begingroup$ "Would have made a lot of sense to just have a invert checkbox on the Transform Geometry Node." Doesn't seem to be an oft requested feature. There is also a all maner of vector operations for you to tailor whatever you mean by "invert" here $\endgroup$ Jun 19, 2023 at 21:25
  • $\begingroup$ I think the inverse of a matrix transform is rather unambiguous within a cg context. The Vector Rotate Node uses a 'invert' checkbox to invert the rotation (matrix), so you can use that together with some math nodes to get it working but it's not a clean workflow for dealing with transforms. $\endgroup$
    – smuseus
    Jun 20, 2023 at 7:15
  • $\begingroup$ Hi, @smuseus.. in the case you present, you don't actually need the strict matrix-inverse of the rotation, just any rotation that will align the object-axes to World. Would that do? Then this would be unnecessary $\endgroup$
    – Robin Betts
    Jun 20, 2023 at 8:16

1 Answer 1

5
$\begingroup$

As of Blender 4.0, if you are trying to find the inverses of transformations made outside of Geometry Nodes, then you can use the following nodes below.

enter image description here

Inverse Translation. To invert your position, you can multiply each scalar of your position/vector by -1 with the Multiply operation of the Vector Math node. Alternatively, you can use the Scale operation with value -1 to invert your entire vector. The later seems to be what most people prefer to use.

Inverse Rotation. Since Blender 4.0 has added the Quaternion data type and new nodes associated with this data type, you can invert your rotation by using the new Invert Rotation Node. Supposedly, Blender 4.1 has already integrated the conversions between Quaternions and all existing data types. But, as of submitting this answer, you would still need to use the conversion nodes, Euler to Rotation and Rotation to Euler with the Invert Rotation Node.

Note. You can easily zero the rotation by aligning your object's axis' to the world origin as Robin Betts mentioned. However, since you are asking for the Inverse Transformation to apply to another object, I gave you the actual transformation instead. Also, to note, if you're still using previous versions of Blender, then Robin Betts answer would be more suitable for your needs.

Inverse Scale. To invert your scale, simply take 1 and divide by your Scale vector. Since a single value n, is converted to vector (n,n,n), when connected, I used a single value node with the Divide operation of the Vector Math node.


Edit

The above Inverse Transformations work great independently. However, as noticed by Markus von Broady, if you're trying to invert two or more outside transformations then the order of transformations needs to be reversed as well.

Order of Transformations. Blender applies transformations in the following order, Scale, Rotation, and finally Translation. To reverse the transformations, simply separate the transformations and apply them in reverse order.

Note. DO NOT ATTEMPT to invert a negative scale value along with another transformation. The Inverted Transforms fails because the object info node only outputs positive scale values.

I could not find a work around for this as it seems to be an issue with Geometry Nodes itself. You can invert the scale with negative values independently but just not along with the other inverted transformations.

I created a custom node group called "Invert Transform Geometry" with your desired Invert checkbox in the file below for you.

Hope this helps.


Blender 4.0.2

$\endgroup$
2
  • 2
    $\begingroup$ Have you tested it? Shouldn't the order of transformations be reversed too? 🤔 $\endgroup$ Jan 1 at 0:46
  • $\begingroup$ @ Markus von Broady, pshhh lol🤣. After you mentioned about the order of transformations, I tested again and found that it doesn't work. I fixed it. However, there is an issue with the Inverse Scale. I am working to resolve it. $\endgroup$
    – Obfuscate
    Jan 1 at 4:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .