Matrix Parameters

From TouchDesigner Documentation
Jump to: navigation, search

Various nodes such as GLSL TOP, Camera COMP, Geometry COMP have parameters that accept matrices. Matrices in TouchDesigner parameters can be specified in a few different ways

Python tdu.Matrix[edit]

A tdu.Matrix object can be build manually, or gotten from various methods in ObjectCOMP Class and COMPs that inherite from that. A matrix parameter can reference a Python tdu.Matrix either directly from a member/method that returns one, or from one that has been placed into Storage.

E.g

 m = tdu.Matrix()
 m.translate(5, 0, 0)
 m.rotate(0, 45, 0)
 op('someNode').store(‘xformMat’, m)
 

and in the node parameter you would put:

 op('someNode').fetch(‘xformMat’)

Table DAT[edit]

A Table DAT can be used to specify a matrix, as a 4x4 table. The translation should be in the last column, which means it is using the convention of multiplying vectors/points on the right of the matrix (like GLSL does).

CHOP[edit]

If a CHOP is used, the 16 elements of the matrix are taken from the first 16 channels of the CHOP. It only uses the first sample of each channel. The matrix data is laid out in such as way that the 13th, 14th and 15th channels contain the translation. This can be thought of as either column or row-major conventions, reading the channels column by column or row by row.

If you are converting from a Table DAT using a DAT to CHOP, you'll want to use a Transpose DAT to get the channels in the correct order.

A form of DATs (Data Operators) that is structured as rows and columns of text strings.

An Operator Family which operate on Channels (a series of numbers) which are used for animation, audio, mathematics, simulation, logic, UI construction, and many other applications.

An Operator Family that manipulates text strings: multi-line text or tables. Multi-line text is often a command Script, but can be any multi-line text. Tables are rows and columns of cells, each containing a text string.