• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
heron3d

what is a practical use for the determinant of a matrix?

10 posts in this topic

Hi, just so I can better understand the matrix. Can one of the math gurus out there give me an example of the practical use of the determinant of the matrix AND the transpose of the matrix?

Thanks
Nikos
0

Share this post


Link to post
Share on other sites
[quote name='heron3d' timestamp='1315980860' post='4861402']
Hi, just so I can better understand the matrix. Can one of the math gurus out there give me an example of the practical use of the determinant of the matrix AND the transpose of the matrix?

Thanks
Nikos
[/quote]

When a matrix is used to represent linear transformations (as is commonly the case in 3D graphics), the determinant effectively represents the degree of unambiguousness inside a matrix.

That is, if determinant is non-zero, the matrix can be inverted because the components don't "cancel out" each other (which would cause zero determinant).

In the same context, transpose of a 3x3 orthogonal rotation matrix is effectively its inverse. This works because the vectors within the 3x3 matrix represent the per-direction scaling factors caused by rotation, and if the vectors represent unique directions with regard to each other (orthogonality), those scaling factors can be simply flipped around to cancel the rotation that the original matrix represents.

In computer graphics, a full transpose of a 4x4 matrix can be done to save some GPU operations. This is related to the physical register layout and the instructions needed to multiply matrices.

Do note that in general, matrices can also be used to represent various other stuff in addition to linear transformations. Therefore, "the matrix" is ambiguous by itself.

Again, in general, matrix inversion is useful if you know the result vector and the linear formula (coefficients of which is what a matrix represents), and you want to find the original vector.
2

Share this post


Link to post
Share on other sites
If you're working in 3D and using 4x4 matricies as transforms, the determinant has an immediately useful value.

If you put a unit cube through the transform, then the determinant will tell you what the volume of the output cube will be; in other words it tells you the volume scaling that the matrix will do.

Hence, well behaved 3D transforms will all have positive non-zero dets; and all rotation/translations which you expect to do no scaling will have a det of 1.

This also helps explain why zero det matricies can't be inverted. In order for it to have det zero, it must shrink one of your unit cube dimensions to zero. Hence there can't be a matrix which goes the other way, because there's no way to reinflate that deleted dimension back to one. Hence there's no inverse for the matrix.

Obviously, since you HAVE to squash one of the dimensions away to go from the 3D world to the 2D render plane, this means all projection matricies must have det = 0. And hence, this is why there is no general case system for taking a pixel in the window and finding it's location in 3D space, because that would amount to being able to invert your projection matrix.
2

Share this post


Link to post
Share on other sites
[quote name='heron3d' timestamp='1315980860' post='4861402']
Hi, just so I can better understand the matrix. Can one of the math gurus out there give me an example of the practical use of the determinant of the matrix AND the transpose of the matrix?

Thanks
Nikos
[/quote]

Most of linear algebra is essential to understand 3d programming and graphics techniques. If you are doing lighting or something related like bump mapping, sometimes you need to convert coordinates from one space to another like convert coordinates to eye space, tangent space, etc... To do that, you come up with a change of basis matrix which is composed of three linearly independent vectors. Let's say you have three candidate vectors but you can't tell whether they form a basis or not. To check that your vectors are linearly independent and hence, form a basis for the space, you could take the determinant of the matrix composed of the three candidate vectors as columns. If the determinant of this matrix is non-zero, then the vectors are linearly independent and you found a basis. This, for example, applies to the famous TBN matrix that you will encounter if you read bump mapping articles. Even just coming up with candidate vectors involves solving systems of equations and using cross-products--all of which make heavy use of the determinant. See [url="http://www.blacksmith-studios.dk/projects/downloads/tangent_matrix_derivation.php"]http://www.blacksmit..._derivation.php[/url] and [url="http://www.blacksmith-studios.dk/projects/downloads/bumpmapping_using_cg.php"]http://www.blacksmit...ng_using_cg.php[/url] for example if you want to know how bump mapping works.

One use for the transpose is that it tells you when a matrix is orthogonal. When a matrix is orthogonal, then its inverse is the same as the transpose. This will be the case for rotations and translations and is good to know so that you can optimize code. When you pass normals to a shader, you won't need to multiply by the normal matrix if all you are doing are rotations and translations. This is because the normal matrix is the inverse transpose which means it's the actually the same as the orthogonal matrix. The TBN matrix that I mentioned above is also orthogonal and knowing this fact makes going from tangent space to world space easy.

[url="http://www.lighthouse3d.com/tutorials/glsl-tutorial/the-normal-matrix/"]http://www.lighthous...-normal-matrix/[/url]
0

Share this post


Link to post
Share on other sites
A linear endomorphism is invertible if and only if its matrix has non-zero determinant.

The signed area of a triangle is
| x1 y1 1 |
| x2 y2 1 | * (1/2)
| x3 y3 1 |

The signed volume of a tetrahedron is
| x1 y1 z1 1 |
| x2 y2 z2 1 | * (1/6)
| x3 y3 z3 1 |
| x4 y4 z4 1 |

Determinants can be used to solve systems of linear equations (Cramer's rule).

The determinant can be used to compute the eigenvalues of a matrix.

The transposed of a rotation matrix is its inverse.

If you have a system of linear equations with more equations than variables, you can reduce the number of equations by multiplying both sides of the equation in matrix form by the transpose of the matrix. The solution of the resulting system is the minimum-squares approximation to the first problem.
0

Share this post


Link to post
Share on other sites
Far from being a math guru, but since I used this not too long ago, here's another use case:

The sign of the determinant of a matrix can be used to calculate the relative position of a point to a plane:

Given four points a=(ax,ay,az), b=(bx,by,bz), c=(cx,cy,cz) and d=(dx,dy,dz) the sign of the determinant of the matrix defined as

[a,b,c,d]=
|ax-dx ay-dy az-dz|
|bx-dx by-dy bz-dz|
|cx-dx cy-dy cz-dz|

shows you the relative position of d compared to the plane defined by a,b,c.

This helps, for example when testing intersections between triangles.

edit: damn editing the post totally messed up my awesome matrix. put in a new line...
0

Share this post


Link to post
Share on other sites
A determinant of zero effectively means there are infinite solutions of x to a system of equations, therefore there is no unique solution.
0

Share this post


Link to post
Share on other sites
[quote name='Katie' timestamp='1315986039' post='4861419']
If you're working in 3D and using 4x4 matricies as transforms, the determinant has an immediately useful value.

If you put a unit cube through the transform, then the determinant will tell you what the volume of the output cube will be; in other words it tells you the volume scaling that the matrix will do.

Hence, well behaved 3D transforms will all have positive non-zero dets; and all rotation/translations which you expect to do no scaling will have a det of 1.

This also helps explain why zero det matricies can't be inverted. In order for it to have det zero, it must shrink one of your unit cube dimensions to zero. Hence there can't be a matrix which goes the other way, because there's no way to reinflate that deleted dimension back to one. Hence there's no inverse for the matrix.

Obviously, since you HAVE to squash one of the dimensions away to go from the 3D world to the 2D render plane, this means all projection matricies must have det = 0. And hence, this is why there is no general case system for taking a pixel in the window and finding it's location in 3D space, because that would amount to being able to invert your projection matrix.
[/quote]

Awesome reply. Thank you Katie
0

Share this post


Link to post
Share on other sites
Thank you for all your great replies. It is a really big help.

Nikos

I will digest the information and see what comes out the other end:)
0

Share this post


Link to post
Share on other sites
[quote name='df2011' timestamp='1316989156' post='4865880']
A determinant of zero effectively means there are infinite solutions of x to a system of equations, therefore there is no unique solution.
[/quote]

This is not strictly correct.


A 1x1 matrix M = [ 0 ] has a determinant of 0, but M*x = 5 does not have a single solution x. (while a trivial example in 1D, it is easy to construct counterexamples for nD as well)

A n-dimensional matrix that is not of full rank (it's column [or row] vectors don't span a n-dimensional space) has a determinant of zero. For a system of linear equations Mx=y, where M is not of full rank, there exists an infinite number of solutions only if y is in the range of M, and the dimension of the solution space is the same as the dimension of the kernel space of M (the degree of freedom for the system).
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0