math & physics
rouncer at June 13th, 2013 10:21 — #1
this doesnt seem to be working, its just nulling off the normal... whats wrong with it?
vilem_otte at June 13th, 2013 10:56 — #2
4x4 matrix is as following:
m00 m01 m02 m03
m10 m11 m12 m13
m20 m21 m22 m23
m30 m31 m32 m33
Where m03, m13 and m23 are translation part of the matrix in case you're using column-major order. Respectively m30 m31 and m32 in case you're using row-major order. The rest (except of m33), e.g. the upper-left 3x3 sub-matrix is rotational part of the matrix.
So first of all, check whether your matrix is okay (and actually has valid numbers in rotational part of matrix - try it with identity, that is valid all day long). Also check that normal is valid before the transformation (it must have length equal to 1).
Also check that your multiplication function is alright, e.g. that it multiplies matrix-column vector in case of column-major order, or row vector-matrix in case of row-major order. Try to multiply some common vertex with common matrix, that should result in known result (F.e. x axis with 90 degree rotation around Z), to confirm the function is okay.
rouncer at June 14th, 2013 00:19 — #3
Ok cool, my problem was I was scaling my z vector by 0 nulling off my vector. It wasnt getting rid of scale for some reason.