**1**

###
#2
Crossbones+ - Reputation: **4368**

Posted 30 September 2012 - 02:00 PM

It would also be ugly to mix 3x4 and 4x4 as i believe you would need a 4x4 for the perspective stuff...

o3o

###
#3
Members - Reputation: **2143**

Posted 30 September 2012 - 03:20 PM

In MathGeoLib, I have the class float3x4, which I use in my game when I explicitly want to specify an affine transform without projection, or as storage to save a few bits, or when I want to save a few cycles off the computations. Those are rather minor though, and therefore just using the same type float4x4 for all math often trumps the rest.

###
#4
Crossbones+ - Reputation: **7022**

Posted 30 September 2012 - 04:55 PM

You need that last row for your projection to work. The 1 in that row copies the z coordinate to use it in the homogeneous divide (there is a point where the view frustum is converted to a 2x2x2 box (each axis going from -1 to +1), and coordinates in this system are called "homogeneous coordinates"). It's a -1 though because of the right hand rule and the way OpenGL's axes work. It needs to be a 4x4 matrix, you see.

###
#5
Members - Reputation: **895**

Posted 01 October 2012 - 09:32 AM

Just curious, apart from the perspective projection, is there any other case where you need the bottom row?To further expand, the OpenGL perpective projection matrix is calculated as so:

You need that last row for your projection to work. The 1 in that row copies the z coordinate to use it in the homogeneous divide (there is a point where the view frustum is converted to a 2x2x2 box (each axis going from -1 to +1), and coordinates in this system are called "homogeneous coordinates"). It's a -1 though because of the right hand rule and the way OpenGL's axes work. It needs to be a 4x4 matrix, you see.

###
#6
Crossbones+ - Reputation: **12262**

Posted 01 October 2012 - 10:37 AM

Just curious, apart from the perspective projection, is there any other case where you need the bottom row?

Any kind of projection needs the bottom row - this includes perspective and ortho, but these are just two special cases of projection, and it's entirely possible to define your own custom projections.

Another case where you need the bottom row is if you need to transpose a matrix; transposing a 3x4 will give you 4x3 and suddenly your matrix * vector multiplications may no longer be valid. Transposing a matrix isn't a rare or exotic or special-case operation either - it's used for lighting.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.