teaching machines

CS 455 Lecture 9 – Orthographic Projection

February 24, 2015 by . Filed under cs455, lectures, spring 2015.

Agenda

Mini Review

  1. What kind of shader data gets blended across the fragments/pixels of a triangle?
  2. What did we need to upload to the GPU to allow vertices to be shared across faces?
  3. What kind of shader data is defined per vertex?
  4. What operation tells us how aligned two vectors are?
  5. What kind of shader data is defined per draw call?
  6. What is the dot product of two unit-length vectors that point in opposite directions? Think about the cosine definition of the dot product.
  7. What happens if you try to transform a vector with a homogeneous coordinate of 0?

TODO

As a lab exercise, add an orthographic projection into one of your renderers:

  1. Add a static GetOrthographic method to the Matrix4 class.
  2. Alter one of your renderers to expand the chunk of the world that is mapped to your window.
  3. Upload the orthographic projection matrix as a uniform to your vertex shader.
  4. Transform the vertex position now by two matrices: projection * xform * position. xform’s job is to position the object into the world, and projection’s job is to map the world into clip coordinates. Those objects whose clip coordinates are in [-1, 1] will appear in your window.
  5. Email me a screenshot of your larger world.

Haiku

on the scale effects of aging
My world grows each year
More stuff, but same pixel count
My world shrinks each year