Previous | Next --- Slide 31 of 62
Back to Lecture Thumbnails
kayvonf

The vertex shader is a side-effect-free function that takes as input a struct describing one vertex from the input vertex stream as well as (optional) read-only "uniform" input data, and computes as output a struct representing the modified vertex.

Here that uniform input data is a 4x4 matrix used to transform the world-space position of the vertex into a canonical normalized clip space position that expected by the rasterization stage of the pipeline. (Further details about coordinate spaces will come later in the course). The same matrix is used to transform all vertices in the input stream.

Note that you should think about a vertex as a struct (a record), and not simply a XYZ coordinate. All vertices need to have a position field, but the vertex record can certain contain many other fields, such as surface normal, surface color, texture coordinates, etc.