YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Perspective Matrix - Interactive 3D Graphics

Get Embed Code
2 Languages

Showing Revision 2 created 05/25/2016 by Udacity Robot.

  1. Here's the perspective matrix formed from the 3JS parameters, the numbers in
  2. the upper left three by three are scale factors, similar to how the
  3. orthographic projection works, though the z scale's a little different. There's
  4. also a translation factor for z. However, the big differences here are that
  5. there's a negative one in the last row. And the lower right corner now has a
  6. zero. I'm not going to derive this projection formula here. Most good 3D
  7. graphics texts run through this process. Also be aware that for some
  8. formulations, the near and far values are negative since you're traveling down
  9. the negative z axis. The one headache of keeping things in a right handed
  10. system is the whole plus is the axis points at the viewer problem. I'm using
  11. positive near and far values in this matrix, because that's how 3JS specifies
  12. things and thank heavens for that. In fact these two values must be positive
  13. numbers for the perspective transform. You can see things would get weird if
  14. the near value for example was somewhere behind the camera. For orthographic
  15. projections we can use whatever numbers we want for near and far. Even negative
  16. values since we're really just selecting a box in space. For perspective we're
  17. doing something more elaborate with transforming space so these values must be
  18. positive. The interesting thing is how this perspective matrix works with
  19. coordinates. Let's take a nice simple case. Field of view 90 degrees, aspect
  20. ratio one. near 1 and far 11. This gives us this matrix. Let's use this matrix
  21. on some test points and see what we get.