teaching machines

CS 455 Lecture 14 – Perspective

Agenda

  • what ?s
  • the limits of orthographic
  • perspective matrix derivation

TODO

  • As a lab exercise, alter one of your renderers to use a perspective projection. (Add a GetPerspective method to Matrix4). In orthographic projections, which don’t really have a physically realistic concept of an eye, we can put the image plane wherever we want, even behind or on the eye. This means our models can also be placed pretty much anywhere. However, with perspective projections, we need the near┬áplane to be away from the eye/origin, and our models must be moved beyond the near plane in order to project onto it. However, we still we want to be able to rotate the model around its own center using our trackball interface. So, we want the model to stay around the origin while we rotate, but then we need to push it away from the origin. We can support both perspective and trackball rotation in the following manner:
    shader_program->SetUniform("xform", Matrix4::GetTranslate4(Vector4(0, 0, -push_from_origin, 0)) * trackball_rotation);
    shader_program->SetUniform("projection", Matrix4::GetPerspective(l, r, b, t, n, f));
    // draw

Haiku

on courting in three dimensions
You think I’m too short
I think you’re too far away
Nearer, I’m dearer

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *