Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualL. Spiro

Posted 16 December 2012 - 06:59 PM


[sx sx  sx  0]
[sy  sy sy  0]
[sz  sz  sz 0]
[0  0  0  1]


What!? What is that matrix supposed to do?

It isn’t supposed to be a matrix. I will explain below.


@L.Spiro

I tried your matrix but this resulted in the terms canceling each other out so that scale values had no effect. Perhaps if you could explain what that matrix should do in a bit more detail?

Let’s say you already have your original matrix in the form of:
[R R R 0]
[R R R 0]
[R R R 0]
[tx ty tz 1]
(Notice the scaling term S has been removed).
Without using matrix multiplies (do not construct a scaling matrix and multiply it with this one, just modify this one in-place) perform the following multiplies:

[R*sx R*sx R*sx 0]
[R*sy R*sy R*sy 0]
[R*sz R*sz R*sz 0]
[tx ty tz 1]


It wasn’t supposed to be seen as a matrix. It was supposed to show you where the scaling values are applied to the final matrix at the end.


This should make it clearer:
/**
	 * Build a matrix from our data.
	 *
	 * \param _mRet Holds the created matrix.
	 */
	LSVOID LSE_FCALL COrientation::BuildMatrix( CMatrix4x4 &_mRet ) const {
		_mRet._11 = m_vRight.x * m_vScale.x;
		_mRet._12 = m_vRight.y * m_vScale.x;
		_mRet._13 = m_vRight.z * m_vScale.x;
		_mRet._14 = 0.0f;

		_mRet._21 = m_vUp.x * m_vScale.y;
		_mRet._22 = m_vUp.y * m_vScale.y;
		_mRet._23 = m_vUp.z * m_vScale.y;
		_mRet._24 = 0.0f;

		_mRet._31 = m_vForward.x * m_vScale.z;
		_mRet._32 = m_vForward.y * m_vScale.z;
		_mRet._33 = m_vForward.z * m_vScale.z;
		_mRet._34 = 0.0f;

		_mRet._41 = m_vPos.x;
		_mRet._42 = m_vPos.y;
		_mRet._43 = m_vPos.z;
		_mRet._44 = 1.0f;
	}
I construct the matrix directly instead of using any matrix math. This is much more efficient. The forward, up, right, scale, and position components are all 3D vectors. Notice that the scaling terms are multiplied all the way across each row rather than just along the diagonal.


L. Spiro

#1L. Spiro

Posted 16 December 2012 - 06:54 PM


[sx sx  sx  0]
[sy  sy sy  0]
[sz  sz  sz 0]
[0  0  0  1]


What!? What is that matrix supposed to do?

It isn’t supposed to be a matrix. I will explain below.


@L.Spiro

I tried your matrix but this resulted in the terms canceling each other out so that scale values had no effect. Perhaps if you could explain what that matrix should do in a bit more detail?

Let’s say you already have your original matrix in the form of:
[R R R 0]
[R R R 0]
[R R R 0]
[tx ty tz 1]
(Notice the scaling term S has been removed).
Without using matrix multiplies (do not construct a scaling matrix and multiply it with this one, just modify this one in-place) perform the following multiplies:

[R*sx R*sx R*sx 0]
[R*sy R*sy R*sy 0]
[R*sz R*sz R*sz 0]
[tx ty tz 1]


It wasn’t supposed to be seen as a matrix. It was supposed to show you where the scaling values are applied to the final matrix at the end.


L. Spiro

PARTNERS