Vector Matrix Toolset v1.0


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Mathieu Goulet-Aubin
Basic operators to work on vector3 and 4x4 transform matrices. Each pixel have its own vector and matrix data. Building blocks to create more complete tools.
Requirements:
11.0, 10.5, 10.0, 9.0, 8.0, 7.1, 7.0 or later
18 Feb 2018
321

Introduction

The toolset is seperated into 2 categories. One to operate on vectors3 and one to operate on 4x4 transformation matrices.
Every pixel can be worked on independently because each can have its own vector and matrix data.

Vector

Vector data is expected to be in the layer rgb.
(r, g, b) = (x, y, z)
Operations like vector addition, substraction, multiplication and division can be done with a standard merge or merge expression node.

Vector_magnitude
Vector_Normalized
Vector_Dot
Vector_Cross
Vector_Apply_Matrix

 

Matrix

Matrix data is expected to be in the layers; matrix0, matrix1, matrix2 and matrix3.

Layers are automatically created by the nodes.


The transformation matrix is stored as followed:
matrix0: [0, 1, 2, 3,
matrix1: 0, 1, 2, 3,
matrix2: 0, 1, 2, 3,
matrix3: 0, 1, 2, 3]


Matrix_Identity
Matrix_Invert
Matrix_Product
Matrix_Transform
Matrix_Translate
Matrix_Rotate
Matrix_Scale
Matrix_Transpose
Matrix_Determinant
Matrix_3x3_det
Matrix_2x2_det

 

 

Vector operators


Vector_Magnitude

Returns the magnitude of a vector. In other words, the vector's length.

The resulted output is repeated to fill up the output vector.

input: vector

output: vector

 

Vector_Normalize

Returns the normalized vector.

Scaling the vector so that its length equal 1.

input: vector

output: vector

 

Vector_Dot

Returns the dot product between 2 vectors.

The resulted output is repeated to fill up the output vector.

inputs: vectorA, vectorB

output: vector

 

Vector_Cross

Returns the cross product between 2 vectors.

input: vectorA, vectorB

output: vector

 

Vector_Apply_Matrix

Returns a new vector resulted by the input vector multiplied by the input matrix.

inputs: vector, matrix

output: vector

 

Matrix operators

 

Matrix_Identity


Returns an 4x4 identity matrix.

The input bg is used to give a format to the matrix.

input: bg

ouput: matrix

 

Matrix_Invert

Returns the inverted input 4x4 matrix.

input: matrix

output: matrix

 

Matrix_Product

Returns the dot product of matrixB * matrixA.

The matrix order is very important as switching A and B will give different results.

inputs: matrixB, matrixA

output: matrix

 

Matrix_Transform

Retuns the input 4x4 matrix transformed by the the node's knobs.

If no matrix is given, the transformations will be made on a identity matrix.

input: matrix

output: matrix

 

Matrix_Translate

Returns the input 4x4 matrix translated by the input vector.

inputs: matrix, vector

output: matrix

 

Matrix_Rotate

Returns the input 4x4 matrix rotated by the input vector.

inputs: matrix, vector

output: matrix

The rotation unit knob specify the rotation unit(degrees or radians) of the input vector.

The rotation order knob specify the order in which the axes are rotated

 

Matrix_Scale

Returns the input 4x4 matrix scaled by the input vector.

inputs: matrix, vector

output: matrix

 

Matrix_Transpose

Returns the input 4x4 matrix transposed.

Values of the matrix are mirrored diagonally.

inputs: matrix

output: matrix

 

Matrix_Determinant

Returns the determinant of the input 4x4 matrix.

The resulted output is repeated to fill up the output vector.

inputs: matrix

output: vector

 

Matrix_3x3_det

Returns the determinant of the input 3x3 matrix.

The resulted output is repeated to fill up the output vector.

Utility operator used by the Matrix_Determinant and Matrix_Invert operators.

inputs: matrix

output: vector

 

Matrix_2x2_det

Returns the determinant of the input 2x2 matrix.

The resulted output is repeated to fill up the output vector.

Utility operator used by the Matrix_3x3_det, Matrix_Determinant and Matrix_Invert operators.

inputs: matrix

output: vector

Please login in order to download these files.

Comments   

 
0 # Erwan Leroy 2018-02-22 14:59
Nice.
We should combine our toolsets, I have one slightly similar for Vector operations only. http://www.nukepedia.com/toolsets/other/vectortools, though I'm missing a few of yours.
 
 
0 # Mathieu Goulet-Aubin 2018-02-27 03:20
Thanks!
You have a great toolset and some very useful tutorials on your website. Its something that i aim to do with mine once i have finished building my other tools which use this one.
I love the idea of having a centralised place for math operators and mine does not cover 2D vectors yet or their 3x3 matrix either.
I am still new to nukepedia so i am not sure how a collab would work but i am all for it.
 
 
0 # Erwan Leroy 2018-02-27 04:12
I don't think there is an official way to do a collaboration, but we could possibly make a GitHub or similar and then release here.
 
 
+1 # Frank Rueter 2018-02-27 04:14
Hi guys, we do have collaboration features in mind for the nukepedia re-write but currently there are none, so yes, using a GitHub/GitLab repo and releasing it here would be the way to go.
 
 
0 # Mathieu Goulet-Aubin 2018-02-27 15:39
Alright, here is my github: https://github.com/mapoga
I can start the project today although i will be on vacation for 3 weeks starting tomorrow so i wont be able to update before i come back.
 
 
0 # Mathieu Goulet-Aubin 2018-02-27 20:55
The repository has been created.
https://github.com/mapoga/nuke-vector-matrix
 

You have no rights to post comments

We have 3310 guests and 123 members online