My notes for: "3D Math Primer for Graphics and Game Development"

Alex Egg,

Triangle has 3 vectors

[x y z w][x y z w][x y z w]

now when you multiply each vector by a transform/translation matrix you get a new coords for the vector, e.g.:

[x y z w] * [x y z w, x y z w, x y z w, 0 0 0 1] = [x' y' z' 1].

Now imagine you do that for each vertex in the triangle – and you have a rotated/scaled or translated triangle. Now imagine that on a larger scale – a whole 3D model. Pretty powerful math.

This is exactly what the vertex shaders in opengl 2.0 do:

void main() 
   gl_Position = modelViewProjectionMatrix * vertexPosition; 

In the above shader program snippet, the modelViewProjectionMatrix is all of my transformations multiplied by each other into 1 handy matrix. I then simply multiply it by vertexPosition which is a vertex in my model. Supposedly this is run for every vertex.

Permalink: 3D-Math-Primer-for-Graphics-and-Game_Development-notes


Last edited by Alex Egg, 2016-10-05 19:17:00
View Revision History