• 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
Waterlimon

Can someone explain projection matrices?

8 posts in this topic

I read a bunch of articles/tutorials about them but didnt understand it fully. So...

1) I put in a position and a projection matrix
2) Complex math
3) I get position as scaled right and x and y divided by its z???

What i dont get is where the x and y are divided by z. Is it even done in the projection matrix?

Explain please O_e
0

Share this post


Link to post
Share on other sites
Every time I see people answering questions like this I see them throwing out a bunch of mathematical proofs that would only explain the concept to someone who had enough mathematical skill to never misunderstand the problem in the first place.

So I will explain in the most simplistic and imagery-based way possible.


When you look at your city, buildings farther away look smaller. As it turns out, any building the same size as another, but twice as far away, will be half the size.
Since Z is the distance away from you, the size of the building is a function of Z.
That is, if the Z value is doubled, the building is twice as far away from you. So to make it twice as small you need to divide by Z.

A projection matrix is designed specifically to facilitate this type of translation.


L. Spiro
0

Share this post


Link to post
Share on other sites
Ever noticed that they are using 4x4 matrices, even though you'd actually just need vectors from R3. They are using 4x4 matrices because they are using homogeneous coordinates. Homogeneous coordinates are basically vectors from R(x+1) where the last component is a scalar factor of the actual Rx vector.

Example:

v1 element of R3
v2 element of R4

v1 = v2 / v2.w
v2 = c * v1

So they simply use the w-component to be able to use the division x/z and y/z.

The division of x/z and y/z can be figured out by using the intercept theorem.
0

Share this post


Link to post
Share on other sites
No what i want to know is what causes the x and y to be divided by z in the projection matrix? I already know the result, but where in the computaton is the division done?
0

Share this post


Link to post
Share on other sites
The division by Z is performed after the projection matrix. The step is usually called perspective division, where you normalize your 3-dimensional homogeneous vector to a 3-dimensional vector by dividing the vector by the homogeneous component (the fourth W-component) of the vector. Basically, the depth is mapped onto the W-component with the projection matrix, and the division by Z is performed in the perspective division stage.
0

Share this post


Link to post
Share on other sites
Honestly, it sounds like you just need to sit down and learn Linear Algebra.

Matrix multiplication is just a mathematical mechanism like normal addition or multiplication or division. You just have to learn how to perform it.


Linear Algebra tutorial. I don't know if this tutorial is any good but it was the first hit on google:
[url="http://blog.wolfire.com/2009/07/linear-algebra-for-game-developers-part-1/"]http://blog.wolfire....elopers-part-1/[/url]


Matrix Multiplication
[url="http://en.wikipedia.org/wiki/Matrix_multiplication"]http://en.wikipedia...._multiplication[/url]

Projection Matrix construction
[url="http://www.songho.ca/opengl/gl_projectionmatrix.html"]http://www.songho.ca...tionmatrix.html[/url]

-me
1

Share this post


Link to post
Share on other sites
I can follow the math somehow, but i just cant see where the w becomes z...

So what were doing is multiplying a 4 component vector by a 4x4 matrix and then dividing the x y and z of the vector by w?

How does the z of the vector get to the w of it? When multiplying the matrix and vector its all like w and parts of the matrix.

Is the z put to w manually, or is the z somehow moved into the matrix in some point or what?
0

Share this post


Link to post
Share on other sites
I will give you an example with OpenGL's matrices. Check out the matrix generated by glFrusutm for example: [url="http://www.opengl.org/sdk/docs/man/xhtml/glFrustum.xml"]clicky[/url]. Look at the bottom row, which is the relevant part of the matrix since it exclusively decides the content of the W-component.

[0, 0, -1, 0] * [x, y, z, w][sup]T[/sup] = 0*x + 0*y - 1*z + 0*w = -z

So, just by multiplying a column vector by that matrix, you can see that the W-component of the resulting vector is the negative Z-component of the input vector. It's standard matrix multiplication.
0

Share this post


Link to post
Share on other sites
Now i get it, thanks... I think i was confused by the other operand being just a vector... i was doing it w=0*w + 0*w blah blah or something similiar.
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