Jump to content

Matrix components


macklebee
 Share

Recommended Posts

Can someone explain how the scale/rotation are saved in the 4x4 matrix?

 

I have this as the result from using GMFDump:

	MESH
Data starts at: 28
	{
28	- 		Matrix: 
	1.00000000, 0.000000000, 0.000000000, 0.000000000
	0.000000000, -1.34358856e-007, 0.999999940, 0.000000000
	0.000000000, -0.999999940, -1.34358856e-007, 0.000000000
	0.000000000, 7.72592878, 0.000000000, 1.00000000

 

and this is what is shown when using the model viewer:

post-14-0-88853800-1312043412_thumb.jpg

 

I assume I have to perform some quaternion/euler conversion for the rotation values... but in any case it doesn't appear that other than the position listed in the last line that the rotation and scale are in any kind of order?

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

An Identity Matrix is...

mat.ix=1 ; mat.iy=0 ; mat.iz=0 ; mat.iw=0
mat.jx=0 ; mat.jy=1 ; mat.jz=0 ; mat.jw=0
mat.kx=0 ; mat.ky=0 ; mat.kz=1 ; mat.kw=0
mat.tx=0 ; mat.ty=0 ; mat.tz=0 ; mat.tw=1

Scale for XYZ is ix, jy, kz

Position XYZ is tx , ty , tz

 

The tricky part is rotation. I tried to write a quick function that I thought would demonstrate it but I kept getting an exception error LOL. I'll come back to it if I figure out why. I wonder if Leadwerks does something funny for rotations.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

Ah, matrix math. That matrix looks right.

 

Line 1: The local x axis points at 1,0,0

Line 2: The local y axis points at roughly 0,0,1

Line 3: The local z axis points at roughly 0,-1,0

 

So the object is pointing down, which makes sense with a euler rotation of 90,-180,180. That's where gimbal lock sets in, so the yaw and roll are a little funny.

 

The scale should be 1,1,1 and it's only because of floating point imprecision that it's not. That happens all the time and isn't a problem.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...