Need help?
<- Back

Comments (17)

  • tmoertel
    The explanation of "What's that extra 1 for?" in the column representation of 3-d coordinates (x y z 1) could benefit from mentioning that translation—moving things—is not a linear transformation (the origin is not mapped to itself) but an affine transformation. Therefore, you cannot represent translation in 3-d space with a 3x3 matrix. What you can do, though, is embed that 3-d space within a 4-d space fixed at some coordinate on its 4th dimension, typically w=1. Then, a translation in the original 3-d space can be represented as a linear transformation in the 4-d space and thus can also be represented by a 4x4 matrix multiplication. So the extra 1 is actually what allows all common 3-d operations, including translation, to be done via linear algebra and thereby harness the brutal power of matrix multiplication on modern computing devices.
  • aappleby
    FWIW, if you start with "The view frustum is a 90 degree pyramid with the tip cut off at z = 1 and the 'end' at infinity", you can then work out how to map that to a NDC using a matrix and perspective divide.I've used that when teaching short "Graphics 101" (not in the first session though) and the math comes out more intuitive than the usual "here's how to calculate a perspective matrix, don't ask where these numbers come from" version.
  • gabrieloc
    Hi! I wrote a few notes on how 3D cameras work with interactive examples to hopefully demystify a pretty complex topic that I once struggled with. Maybe this is useful for someone here, and if not, there are fun sliders to play with!
  • rhyperior
    At one point all of this seemed like common knowledge in software because Carmack, Abrash and Hecker (among many others) were working in the open on games and discovery. Kind of funny that someone had to reinvent from first principles!
  • throwaway219450
    A fun demo of this from earlier this year (Tsoding): https://www.youtube.com/watch?v=qjWkNZ0SXfo The good stuff starts around 7 mins, but it’s a great presentation and it’s almost magical how everything comes together.
  • JKCalhoun
    Like the post, I wrote an old-school 3D engine that does the same math—renders flat-shaded polygons in an HTML5 Canvas.Demo: https://engineersneedart.com/Phosphor3DTest/(cursor keys drive the sand crawler, square-brackets change FOV)Sources: https://github.com/EngineersNeedArt/Phosphor3D(I was seeing a few anomalies and sent Claude to investigate—found a math error or two. There are still some anomalies in depth sorting the polygons but not due to the code, I believe—instead the model itself.)
  • doubletwoyou
    This is a beautiful post, good work!Really loved the examples of the math being put into action with those lovely little sliders
  • nik282000
    wtf, I thought this was THE cheap way to 3D.
  • skzv
    Awesome. To take this a step further, I used this math to turn 2D photos into 3D scenes with depth maps: https://blog.skz.dev/3d-reconstruction-from-public-photos
  • TN1ck
    The sliders are great UX on mobile, love the detail to attention.
  • xcafebabe
    [dead]