Questions tagged [matrix]

A matrix is a mathematical object consisting of a rectangular array of (in blender's case) numbers. Matrices are used in 3D graphics for computing coordinate transformations. Blender uses matrices in the material node system for this purpose and internally for similar purposes. The internal representation can be accessed through bpy. Use this tag for questions about matrices in either the node editor or python.

Filter by
Sorted by
Tagged with
1 vote
0 answers
15 views

Converting a weak perspective Camera (SMPL) to a orthographic/perspective projection model

I am currently trying to import and parse outputs from the SMPL/VIBE model into Blender. The goal is to overlay the predicted mesh/armature on the original image and render it in blender similar to ...
  • 11
2 votes
1 answer
35 views

Get view and perspective matrices of the current 3D viewport (not camera)

I'm making a script allowing me to apply fragment shaders to the 3D Viewport real-time. However, I don't know how to get view and perspective matrices of the current point of view. I know how to get ...
0 votes
0 answers
13 views

is it posible to work an image with kernels and matrix in blender?

I'm working on some postprocessing add-on, and I was wondering if there is a way to work on an image with kernels and pixel matrix, since a lot of the effects I want to implement depend on them, ...
  • 112
0 votes
0 answers
15 views

How to Copy the Matrix of Curve1 to Curve2 but keeping the transform(no parenting)?

Curve1 Curve2 I am trying to copy the the (Transform) Matrix of the Curve1 to Curve2, while keeping the current point locations unchanged. (For sharing the same transform axes: same up, down etc for ...
0 votes
0 answers
25 views

Bone matrix roll incorrect 3.4

I have an import script written for 2.79 that im trying to port to 3.4, i managed to fix everything except the part of the script that imports the armature.. It does not calculate the correct bone ...
0 votes
0 answers
21 views

Automatically apply Matrices4x4 transform on Objects

I'm working on a reverse-engineering tool, it extracts maps from a game, and the game actually stores the positions of objects instances using Matrices4x4 transformation. I would like to know how I ...
0 votes
0 answers
31 views

Python Rotate bone to point toward a specific location

I have a simple task to do in Blender but I don't find a proper way to make it work. Here it is : I have a bone in my scene and i want that bone to rotate in such a way that it points a specific ...
  • 3
0 votes
1 answer
28 views

matrix_world is transposed silently under the hood? Why?

I'm setting the matrix_world property of an object (from a numpy array) and I discovered that: The last column (translation) is not set. The matrix appears ...
  • 123
0 votes
0 answers
23 views

How to get the camera pose relative to an object in the scene?

I am working on a camera calibration script in order to get a camera extrinsic matrix. I have a calibration object and am able to recover the camera pose and thus the extrinsics. I want to validate ...
  • 1
0 votes
1 answer
53 views

Rotate object's matrix_world

I need to rotate the matrix_world of an object through a quaternion q without changing its actual rotation (i.e. rotation in world space). How to do that through a ...
0 votes
0 answers
22 views

Location of child object

I have a child object c parented to another object p. If now I check c.location from python console it's totally different than the one shown in the item tab of the ...
1 vote
0 answers
50 views

Object's matrix_parent_inverse Value After Parent's Origin Change

If the matrix_parent_inverse of an object o that's parented to another object p is initially M1, and if it becomes M2 after the origin of p is shifted by Vector v, ...
1 vote
1 answer
72 views

Parenting to a Curve with Python leads to unexplained results

I'm trying to set a Curve as a parent to objects using Python. My Curve's position is 0,0,0 at the World Origin. When I run the script below, the cubes get parented to the Curve and jump to a ...
0 votes
0 answers
36 views

Mirroring a child object

I'm trying to write a script that will mirror a child object. I started with this post from Blender Stack Exchange. This script works when the object is unparented, but it doesn't work when there is a ...
0 votes
2 answers
72 views

Can I manipulate a posebone in Python script?

So I wanted to adjust a posebone using Python script, and I ran into something wierd: ...
  • 164
0 votes
0 answers
25 views

Converting external application Matrix to blender matrix

I'm attempting to convert Roblox CFrame (Matrix) to Blender's matrix, the purpose of this is to enable camera animation exporting and importing said camera animation into blender, the ultimate goal ...
3 votes
1 answer
43 views

Passing an arbitrary sized matrix as a property of an operator

I'm trying to create an operator that takes as an input a matrix (ideally a numpy matrix) and creates and edits several objects based on the size and values of said matrix. As far as I understand, the ...
  • 33
0 votes
0 answers
29 views

Pose bone matrix assignment: transform OK when assigning to a 2D 4x4 array, gets messed up when assigning to a Matrix()

I'm writing a plugin for Blender and I've stumbled upon this issue. In my code, I have a 4x4 2D array with my transform matrix (let's call it mat44). I also have an ...
1 vote
0 answers
366 views

Check if any points of an objects bounding box is inside the bounding box of another object

I'm trying to make a script that'll find if any points of an objects bounding box is inside the area of a different objects bounding box. My thought was to cancel out the rotation of the object I'm ...
  • 336
1 vote
0 answers
62 views

How to get euler/quaternion rotation from matrix?

I have 2 bones and I want to copy the rotation of one bone to another using only rotation_quaternion or rotation_euler to assign ...
0 votes
1 answer
58 views

Multiplying bone rotation matrix results in identity matrix

This is a complicated question. I have a math formula of how to convert a rotation matrix from a bone to result in the same rotation for another bone on another skeleton given that skeleton has an ...
1 vote
0 answers
27 views

Does Python round matrix elements?

I was doing matrix multiplication with a calculator and in python and it seems like small numbers were rounded up to 0 in python is this real or did I make a mistake? Can you somehow override this to ...
1 vote
1 answer
484 views

What is the fastest way to set global vertices coordinates to a numpy array using bpy?

The fastest way I know to get the vertices coordinates from the mesh is to use .foreach_get() method: ...
0 votes
0 answers
151 views

Rotation matrix .to_euler

I have a series of rotation matrices that I would like to apply to different objects. If I create a mesh for each object and use the mesh.transform(Matrix) method then the transformation works ...
0 votes
0 answers
68 views

Custom exporter, problems with rotations and positions

I'm working on a custom exporter for blender, the idea is to export the geometry to be used in an external tool. But we have a big problem, is very difficult to apply the rotation matrix and make it ...
  • 45
1 vote
0 answers
124 views

How to properly combine Rotation Quaternion with Matrix for viewport/RegionView3D manipulation?

(Copy and pasted it from another place since I wasnt getting any replies) Hi, I am working on an addon that uses external application's touch gesture to send information to a socket, which then is ...
4 votes
1 answer
179 views

How to update world transformation matrices without calling a scene update

I have a Python script that's recursively parenting children objects to parents. I can use bpy.ops.object.parent_set(), which produces the desired outcome but is too slow for what I'm doing. Another ...
  • 3,250
0 votes
0 answers
41 views

Cannot import 3x3 rotation matrix (possible skew?)

I am importing a custom game model format (originally exported from 3ds Max or Maya) which stores hierarchical empties or tri-list meshes together with separate XYZ locations, 3x3 rotation matrices, ...
  • 723
1 vote
0 answers
86 views

Mapping voronoi cell local space align perpendicular to a spherical surface?

With blenders voronoi texture each cell has a local space. My goal is to use these voronoi cells to scatter a volumetric shader, like the volumetric gizmos below, with each volumetric cell instance ...
0 votes
0 answers
125 views

Rotate an object so polygon normal faces a world coordinate

Rotate crystal to polygon[face_idx] to face Vector((0,0,0)) This is what i have gathered so far. to do it in 2 rotations, my math could be off aswel. first rotation to line up object location->...
0 votes
0 answers
11 views

This mathutils related code stop working correctly in 2.8 [duplicate]

I ported an old 2.78 addon and was faced with a strange thing, the results in 2.78 and 2.93 are different. In 2.93 the result of the multiplication of matrices is always remaining the same as Matrix....
1 vote
0 answers
874 views

Rotation matrix to_euler, Euler angle decomposition order reversed?

Is Blender's euler decomposition order reversed from common convention? I have written some code below that demonstrates this, and am wondering if I'm making a mistake. I'm having trouble ...
  • 11
3 votes
1 answer
229 views

What does ''Axis'' input of Vector Rotate node do?

What does the Axis input do? I’m aware that if the input is 0-1-0, the rotation will be performed around Y axis, 1-0-0 for X axis and 0-0-1 for Z axis. The math to perform the rotation using those ...
1 vote
0 answers
131 views

Matrix multiply a Vector using Loc/Rot/Scale Attributes

I am making a setup that uses Object Coordinates from an Empty as Normals. This works great until you start moving the object with a rig, at which point you realize that these "Normals" are ...
  • 6,303
2 votes
0 answers
42 views

Trying to get the right orientation matrix

So i'm using a importer that uses a matrix and changes the transform and when i try and import with my keyframe data the arms and legs are like backwards? Crossed not sure how to explain it. So i'm ...
1 vote
1 answer
102 views

Create a list of matrix_world.translation for child object for n frames of animation

I want to save the location of a child object during the parent's animation. My code populates the list with the last read value and none of the other values. If I print the z location each iteration ...
  • 29
1 vote
1 answer
109 views

matrix_basis doesn't set to the values I am setting it to

So, I'm importing animation data from a text file, containing the bonematrix for each frame and each bone. I am simply setting the matrix_basis of each bone and adding a keyframe, and repeating. The ...
  • 11
0 votes
1 answer
525 views

bpy.types.Bone.matrix vs matrix_local

According to the doc: matrix 3x3 bone matrix matrix_local 4x4 bone matrix relative to armature I guess matrix_local is the full transform matrix that describes ...
  • 1,862
0 votes
1 answer
74 views

axis_conversion producing unexpected result?

I am attempting to convert the world transforms of scene objects into a different coordinate system (-Z forward Y up) using axis_conversion method as follows: ...
5 votes
1 answer
1k views

How to Decompose and Compose the local transform matrix

The Setup: I have a simple setup with two cube objects with a parent child relationship like so: The Red cube is a child object of the green cube. The Red cube has the following transforms: The ...
4 votes
2 answers
240 views

Align viewport rotation to normal vector like Shift+7 in edit mode

I know this question has been asked and answered before but the behavior I want is what ⇧ Shift + Num 7 exactly does in edit mode which is to align the viewport to "face" the element ...
1 vote
0 answers
85 views

Different euler rotation from same Matrice between Blender and Maya

My problem is the following: I start from the same matrix between Blender and Maya and I want to get the euler rotation in degrees of this matrix. The problem is that I don’t get the same results at ...
  • 31
1 vote
0 answers
283 views

Convert quaternion from Blender to Unity

I want to convert an euler or quaternion rotation from Blender to an euler or quaternion rotation on Unity. The goal is not to export an object from Blender to Unity, but only to convert the rotation ...
  • 31
0 votes
1 answer
421 views

I want to scale an Object along its local Axis and the return it to its initial scale using the global Axis

...
0 votes
1 answer
146 views

Get vector location list from matrix list via script node in Animation Nodes

I want to be able to view the coordinates of the locations of the matrices after I have manipulated the matrices with matrix nodes. Would someone be able give me an example script, which I assume ...
0 votes
1 answer
69 views

Random step between instances on animation nodes

Can the step distance between instances on animation nodes with a matrix distributed in a spline be random or varied? I just need the distances between the cubes to not be even.
  • 133
2 votes
1 answer
162 views

Rotate vertices to any arbitrary rotation

I'm trying to rotate a set of vertices (in the example code they form a triangle but will be an arc) to any arbitrary rotation. I start by building a base triangle on the X,Y plane with a Z normal. ...
  • 73
2 votes
1 answer
692 views

Python, How to get pose bone to rotate with another pose bone from a different armature? Finding Rotational difference

I have two Armatures with different bone structure. The goal is to get the rotational difference of one bone from a one Armature and translate it to the bone of the other Armature. Code **For a ...
4 votes
2 answers
994 views

Which matrix to use to transform children local coordinates to global?

Setup I have an object Plane with 6 vertices. To each vertex I assign another object as child. Then I apply two keyframes on location to object Plane: In frame 0 it goes to Z = 5 In frame 81 it goes ...
  • 93
0 votes
0 answers
74 views

recreating a scene from THE MATRIX

for a video project I am trying to re-create a scene from the Matrix. https://www.google.com/url?sa=i&url=https%3A%2F%2Fgfycat.com%2Fru%2Fhelpfullavishboilweevil-virtualworlds-thematrix-fairuse&...
  • 105