New answers tagged

0

There's a trick you can use to numerically remove (or rather reduce as much as you want) any scaling from the upper 3x3 sub-matrix, assuming it's not singular. Let's call that 3x3 sub-matrix M. You can take the transpose of the inverse of M, and average it with M. That will be the new M for the next loop. while (...) { N = (transpose(inv(M)) + ...


2

NOTE: Edited because it was likely too verbose (source). A rotation matrix actually always defines an orthonormal basis. What this means is each column defines one of your original axes in its rotated state. For example, consider a simple rotation matrix around the z-axis (more on rotation matrices here). Let's say we plug in Pi / 2, in other words, we ...


0

In my own project I suddenly came to the same conclusion - the parent scale shouldn't be passed down to the children's transformation matrix. And I thought it was weird too. I figured, if you want to stay consistent throughout your code, either you pass through all of it, or you pass through nothing. However, seeing how you came to the same conclusion is ...


1

Your whole matrix is incorrect. For example, this is one of the ways it should look like: So, in code: dest.m00 = 1.0f / (tanHalfFOV * aspectRatio); dest.m10 = 0; dest.m20 = 0; dest.m30 = 0; dest.m01 = 0; dest.m11 = 1.0f / tanHalfFOV; dest.m21 = 0; dest.m31 = 0; dest.m02 = 0; dest.m12 = 0; dest.m22 = -(far + near) / range; dest.m32 = -2 * far * near / ...


0

Indeed, you need an additional orientation hint for this to work. It is quite common to use an “up” vector in addition to the view vector that you computed. Most 3D libraries have some kind of “lookat” function: Transform.LookAt in Unity3D, glm::lookAt in glm, or the deprecated gluLookAt in ancient OpenGL. Note that if the “up” vector is constant or only ...


2

Assuming your matrix multiplication follows the convention... M * v = (T * R * S) * v (where M is your composed matrix, T is a Translation matrix, R rotation, S scale, and v is a vector you want to transform using the matrix) ...then you can normalize the first three columns of the matrix to get just the T * R part. If you use the opposite matrix ...



Top 50 recent answers are included