Why SRT In Matrix ?

Discussions about SOFTIMAGEs© Interactive Creative Environment©
Post Reply
Falam

Why SRT In Matrix ?

Post by Falam » 09 Apr 2013, 03:15

How come matricies are read S,R,T with translation being last, what is the reason for this in 3D software ?

NNois
Posts: 754
Joined: 09 Jun 2009, 20:33

Re: Why SRT In Matrix ?

Post by NNois » 09 Apr 2013, 10:30

nope transformations aren't applied in this order i think take a look at wikipedia...

If you can translate french maybe you can read this article who explain you the transforms in ICE and in particular convertion between local and global
http://fbonometti.blogs.3dvf.com/archives/799

User avatar
dwigfor
Posts: 395
Joined: 17 Nov 2009, 17:46

Re: Why SRT In Matrix ?

Post by dwigfor » 09 Apr 2013, 14:51

I made a tutorial awhile back to try to explain 4x4 matrix - http://www.si-community.com/community/v ... =41&t=1707

My first attempt to understanding matrix was from trying to translate XNA game code into ICE. It's a bit of a mess; maybe there's something in there helpful - http://www.si-community.com/community/v ... t=game+xna

The top (left) 3x3 matrix is used to calculate scale and rotation. The numbers correspond to the direction that the axis points at. So pointing out in X (normalized) is 1,0,0. Y = 0,1,0, Z = 0,0,1.

Identity matrix
1,0,0
0,1,0
0,0,1

Scaling in X by 2x would be 2,0,0. Scaling half of Y would be 0,.5,0. When you rotate the matrix, the numbers will change, utilizing sin and cos to calculate the new vector.

Because of the way they are calculated, it allows you to apply other mathematic operations to the matrices (multiplying them together, etc). Hopefully that helps explain.

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Why SRT In Matrix ?

Post by Daniel Brassard » 09 Apr 2013, 15:32

Softimage is row-major vector based, so the SRT is the correct order of operation in Soft (and an easy way to remember it).

Be careful with Wikipedia and other math primer, you have to understand the difference between row-major vector and column-major vector operation on matrices. As an example, OpenGL is column-major vector based and therefore the matrices and order of operation will be different. To translate column-major matrices into row-major matrices, you will need to "transpose" the matrix.

Code: Select all

OpenGL

 | mo m4  m8  m12 |
 | m1 m5  m9  m13 |
 | m2 m6 m10  m14 |
 | m3 m7 m11  m15 |        

Code: Select all

Soft 
 |  m0   m1   m2  m3 |
 |  m4   m5   m6  m7 |
 |  m8   m9  m10 m11 |
 | m12  m13  m14 m15 |
You also have to factor in the coordinate system you are working with (left hand or right hand coordinate). This will have an impact on the matrix order and representation. Softimage is a right hand coordinate system with Y axis up.

I have attached the matrix representation in Softimage for your info. Please note that I am using affine transformation matrices (4x4 matrix). This is easier to work with when translation is included.
Attachments
Softimage matrix.jpg
$ifndef "Softimage"
set "Softimage" "true"
$endif

Falam

Re: Why SRT In Matrix ?

Post by Falam » 11 Apr 2013, 00:25

Daniel Brassard wrote:Softimage is row-major vector based, so the SRT is the correct order of operation in Soft (and an easy way to remember it).

Be careful with Wikipedia and other math primer, you have to understand the difference between row-major vector and column-major vector operation on matrices. As an example, OpenGL is column-major vector based and therefore the matrices and order of operation will be different. To translate column-major matrices into row-major matrices, you will need to "transpose" the matrix.

Code: Select all

OpenGL

 | mo m4  m8  m12 |
 | m1 m5  m9  m13 |
 | m2 m6 m10  m14 |
 | m3 m7 m11  m15 |        

Code: Select all

Soft 
 |  m0   m1   m2  m3 |
 |  m4   m5   m6  m7 |
 |  m8   m9  m10 m11 |
 | m12  m13  m14 m15 |
You also have to factor in the coordinate system you are working with (left hand or right hand coordinate). This will have an impact on the matrix order and representation. Softimage is a right hand coordinate system with Y axis up.

I have attached the matrix representation in Softimage for your info. Please note that I am using affine transformation matrices (4x4 matrix). This is easier to work with when translation is included.
I understand the Translation, and scaling of a matrix, not so much the rotation from the graph image.

User avatar
dwigfor
Posts: 395
Joined: 17 Nov 2009, 17:46

Re: Why SRT In Matrix ?

Post by dwigfor » 11 Apr 2013, 02:11

Falam, please try to understand this inside of ICE by show numeric values. It's very hard to comprehend just by looking at a grid of numbers on a website... Store a SRT to Matrix -> 4x4 matrix (force it to a 4x4 matrix) -> set data. I would show values on each section, 1 showing Axis, 1 showing numeric. Then rotate the numbers around each axis 90 degrees. Notice how the numbers in the matrix change. REMEMBER: they correspond to the vector that the axis is pointing at.
1,0,0
0,1,0
0,0,1

As you rotate them at 90 degree intervals (and assuming Scale =1), you will see those numbers changing between -1 and 1. So maybe:
1 > 0 > -1 > 0 > 1 or maybe
0 > -1 > 0 > 1 > 0 or
0 > 1 > 0 > -1 > 0. That's the Cosine and Sin at work for ya.......

It is SOOOOOOO much easier to grasp this stuff when you can visualize changes thru ICE!!!!
Please try first in ICE, and then report back.

Falam

Re: Why SRT In Matrix ?

Post by Falam » 11 Apr 2013, 03:03

I did try in ICE before asking the question, I wanted to know how Softimage solves a matrix, that I have an understanding for. Surprising that rotations are just SIN and COSINE curves.

User avatar
dwigfor
Posts: 395
Joined: 17 Nov 2009, 17:46

Re: Why SRT In Matrix ?

Post by dwigfor » 11 Apr 2013, 04:55

Makes sense when think about it. How do you calculate points moving around a circle... Cos and sin. ;)

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Why SRT In Matrix ?

Post by Daniel Brassard » 11 Apr 2013, 05:28

$ifndef "Softimage"
set "Softimage" "true"
$endif

Falam

Re: Why SRT In Matrix ?

Post by Falam » 13 Apr 2013, 02:36

I have to do some of my own studying on this, I see what is going on when I visual in ICE, still not understanding, for the thread here is what I did.

Image

Image

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Why SRT In Matrix ?

Post by Daniel Brassard » 15 Apr 2013, 16:03

Also read this, may be useful to understand transformation in Softimage. An oldy but still good.

http://www.isner.com/Transform/IsnerTra ... nip_04.htm
$ifndef "Softimage"
set "Softimage" "true"
$endif

Falam

Re: Why SRT In Matrix ?

Post by Falam » 15 Apr 2013, 16:08

Daniel - I have those papers :)
I do believe once you figure out matrices, you may not be at an advanced level, but heading in that direction at a good speed :)

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Why SRT In Matrix ?

Post by Daniel Brassard » 15 Apr 2013, 16:33

:D
Attachments
Yoda_matrix.jpg
Yoda_matrix.jpg (48.82 KiB) Viewed 753 times
matrix has u.png
$ifndef "Softimage"
set "Softimage" "true"
$endif

Post Reply

Who is online

Users browsing this forum: No registered users and 68 guests