How can I apply a 3x3 or 4x4 transformation matrix to a mesh such that the matrix's transformation is baked into its geometry?

E.g. applying the following matrix...

\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 0.707 & 0.707 & 0\\ 0 & -0.707 & 0.707 & 0\\ 1 & 0 & 0 & 1\\ \end{bmatrix} ...to the cube primitive should yield the result below, only by changing the mesh's vertices. Example of transformation Thus the object-level transformation depicted in the properties panel will remain unchanged.


2 Answers 2



import bpy
from mathutils import Matrix

ob = bpy.context.object
me = ob.data

M = Matrix(((1, 0, 0, 0),
     (0, 0.707, 0.707, 0),
     (0, -0.707, 0.707, 0),
     (1, 0, 0, 1)))

  • 1
    $\begingroup$ ..just curious.. how would you kick a 3D view into refreshing, to display the transformed mesh? $\endgroup$
    – Robin Betts
    Jan 24, 2019 at 8:23
  • 2
    $\begingroup$ Edited answer, added a call to mesh update. Personally would do this with bmesh operators, this seemed the simplest answer to this q. $\endgroup$
    – batFINGER
    Jan 24, 2019 at 9:19
  • $\begingroup$ I wonder why blender only applies the rotation component of the matrix and not the translation (last column) $\endgroup$
    – Sergio
    Oct 11, 2022 at 8:33

If you create the cube and select it, and then go to the python console, the following should produce what you are asking for.



I don't know that there is a way to manipulate that directly in the UI.

  • $\begingroup$ Thanks much, this does indeed help! Yet, this method plainly sets the mesh's object-level transformation. I can then, of course, simply bake the object-level transformation to a mesh, but it's a bit tedious for a mesh with a non-identity object-level transformation. I'd have to note down the object-level transformation, zero it out, use the console to input a matrix (for the object-level transformation), apply the current object-level transformation, then re-input the previously noted object-level transformation. Perhaps there is yet a faster way to bake in a matrix transformation? $\endgroup$ Jan 23, 2019 at 22:49
  • $\begingroup$ I'm not sure what you mean by 'bake'. Are you wanting to keyframe, perhaps? Or are you wanting to bake in terms of materials? Do you have something you are trying to accomplish by 'baking'? That might help clarify for me how to do what you want. :) $\endgroup$
    – Rick Palo
    Jan 23, 2019 at 23:28
  • $\begingroup$ By "bake", I'm referring to the function of the "Apply Object Transform" operation, which takes the object-level transformation and applies it to the vertices of a mesh. In other words, changing the level at which the transformation exists (from object as a whole -> to vertices), so that the object-level transformation resets to zero and the appearance of the geometry is kept unchanged. Moving every individual vertex (by the matrix) instead of moving the object's position as a whole. It's kind of like taring a scale. $\endgroup$ Jan 23, 2019 at 23:39
  • $\begingroup$ Run bpy.ops.object.transform_apply(rotation=True) after setting the matrix world. $\endgroup$
    – batFINGER
    Jan 24, 2019 at 6:07

You must log in to answer this question.

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