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.

120 questions
Filter by
Sorted by
Tagged with
44 views

How can I use convolution matrix in Shader Node

I want to use a convolution matrix so that I can create a Gaussian Blur for the image without it having too much noise. I saw someone upload it to BlendSwap and also something else here on ...
39 views

Python exercise to learn - spiral circular shape

I’m trying to use bmesh extrusion and Matrix to do some spiral shape like this : I would like to start from a circle (like it is described on the picture) Here where I’m stuck: ...
39 views

Recreating clip space coordinates in Blender shader nodes

I've been trying to recreate the clip space coordinate system in Blender's shader nodes. From what I know, the only coordinate systems you have access to are object coordinates (position), world ...
• 96
11 views

How to export posebone location, rotation and scaling including IK?

Not sure if that is a perfect title, I'm doing a mesh skinning shader in Game Maker and it is done, both the model and bones are exported from Blender (after struggling making an exporter) My problem ...
• 21
30 views

Blender's bone.matrix_basis.to_euler() output data is flipped on some bone

I'm currently writing a blender addon to export animations to a json format which i can use for my projects. My current way of exporting is this: I grab the matrix of the armature bone: ...
1 vote
40 views

Orientate a rotated and scaled cube to global x,y & z axis

I have a rotated and scaled cube (on all axis) with the rotation and scale applied. For example: As I don't know the original rotation and scale, using Python I'd like to align the cube along the ...
• 215
80 views

Proper GPUOffScreen projection matrix from viewport

How to get proper GPUOffScreen projection matrix from viewport? API docs have example only for camera. I tried using view_matrix ...
• 1,069
49 views

Trying to replicate Matrix Object from C4D in Blender

I am trying to figure out if there is a way to replicate this? Basically being apply split a Mesh Object into an array of cubes or spheres. The video here is a visual representation of what I am ...
• 87
61 views

Blender 6D pose data generation

I am trying to get relative pose of object ( x,y,z and rotations ) with respect to the camera. My object is placed at origin (0,0,0) World Coordinates and the camera is following a trajectory while ...
1k views

How do you invert a transformation in geometry nodes?

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 ...
• 77
112 views

blender python transfer pose bone position to an object (matrix issue)

I have an object inside a bone, matches the bone exactly (position, scale, rotation). The armature and the object have different origin points. I am trying to make the object follow the bone exactly ...
• 227
105 views

Rotate camera around target object (within limits) using python & math utils, whilst maintaining camera facing toward target

I am writing a script to procedurally generate images of a target object on a terrain. The basic logic I am thinking of is to have the camera directly above the target pointing straight down, apply ...
• 35
1 vote
52 views

How to get a list of all the object in the camera's FOV?

How to list all the objects in the FOV of the camera? I tried projecting the vertex with the projection matrix, but objects not in the view are still projected on the image plane. Hence is there any ...
• 11
203 views

Camera Matrix Not Updating After Moving Camera

I am developing a short macro to find the optimal distance to place the camera from an object, so it is fully contained in the render. One simple solution is to use the maximum side of the bounding ...
• 133
181 views

Camera projection matrix is always the same

I wrote a simple python script to render a scene from different points of view. For each rendered image i also need to save the projection matrix of the camera that took the picture. I try to get the ...
1 vote
277 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
482 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 ...
31 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 ...
• 11
44 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
170 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 ...
67 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
70 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
154 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 ...
147 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
117 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
951 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 ...
• 423
1 vote
141 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 ...
• 477
145 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
54 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
860 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: ...
• 1,111
1 vote
317 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 ...
614 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,412
276 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 ...
13 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
2k 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
290 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 ...
• 592
1 vote
283 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,629
58 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
314 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
227 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
1 vote
1k 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 ...
• 2,012
110 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: ...
2k 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 ...
412 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
159 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
513 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
694 views

...
189 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 ...
81 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