Math for Game Developers: Why do we use 4x4 Matrices in 3D Graphics?

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024

Комментарии • 172

  • @MuriloFernandoFloriani
    @MuriloFernandoFloriani 3 года назад +112

    More people should know about your lectures. Really good stuff.

    • @pikuma
      @pikuma  3 года назад +5

      Grande Murilo! :)

  • @calvinsoueid772
    @calvinsoueid772 3 года назад +97

    I've been searching for hours for a good explanation, and in 5 minutes you've already blown my mind. How is it nobody else can explain it this well?

  • @sircalvin
    @sircalvin Год назад +10

    the 2d->3d->2d shearing example genuinely made my jaw drop, i finally get it!

  • @DevonVanNote
    @DevonVanNote 3 года назад +22

    Gustavo you saved me hours and hours of research. I'm a software developer of 4 years and applied for a Gameplay Programmer position, which doesn't require to have to made a game before but does require I understand concepts like this. Fantastic video! The ending blew my mind! Thank you!

  • @StarFury2
    @StarFury2 Год назад +9

    I guess the need for 4x4 arise from our wish to only use multiplication to apply all transformations at once (transformation = coordinates ⋅ R ⋅ S ⋅ T).
    Because if, alternatively, we use transformation = coordinates ⋅ R ⋅ S + T , it seems we do not need an additional dimension. Simply apply RS transformation and add dx, dy, dz to position points in 3D space. But yes, very cool idea and explanation why multiplication requires higher dimension.

    • @andrewgraham1771
      @andrewgraham1771 10 месяцев назад

      This is how it was done on the playstation 1.

  • @Metacious
    @Metacious 3 года назад +7

    I don't remember how I found Pikuma, but it is one of the best courses I've had for computer graphics. Much appreciated.

  • @adamblance3346
    @adamblance3346 2 года назад +3

    You were able to completely explain it in the first few minutes, but I'm so glad I stuck around for the rest. Thanks so much!

  • @TheGRoques
    @TheGRoques 3 года назад +9

    The result of a shear in 3D is a translation in the 2D plane. This is a fascinating insight, and very helpful for extrapolating to 4D! :)

  • @t3hPoundcake
    @t3hPoundcake Год назад +3

    This blew my mind. This is such an incredible and intuitive (even with the 4 dimensional aspect) way to interpret and think about translations in 3d space in computer graphics. I never put that together in my head before in such a clear and understandable way, I just knew "well you need a 4d matrix" and let the magic happen. This is a wonderful video.

    • @Bunny99s
      @Bunny99s 5 месяцев назад

      Right, the more you think about higher dimensional space, the more generalized you can see the lower dimensions. It's often said that in 2d space you can only rotate around point and in 3d space you rotate around an axis. Though generally speaking that's not really true. In many cases when talking about 2d rotation people imagine a rotation axis going through the point of rotation. So the try to visualize the 2d case as the 3d case. However it's only in 3d that rotations actually rotate around an axis. In reality rotations happen inside a 2d plane. This is true for all dimensions. That's why 2d space has just 1 way to rotate since there is only one 2d plane which is the whole space, you have 3 rotations in 3d space (xy, xz, yz) and why you get 6 rotations in 4d space (xy, xz, xw, yz, yw, zw).
      Also most understand that a 2d plane has a normal vector. Though this is also not true. In 2d space you again have to imagine 3d in order to define the normal. However in 4d space a single 2d plane requires two normal vectors or another orthogonal 2d plane in order to be defined properly. "Hyperplanes" are defined the same way in all dimensions. However a 4d hyperplane is actually a 3d volume with distance "d" and not a 2d thing. A hyperplane in 2d space would be an infinite line with distance d from the origin. Such a hyperplane is always defined by a normal vector and a distance from the origin. In 4d space having a single normal vector leaves us with a 3d space that is orthogonal to that normal. This is what homogeneous coordinates essentially represent. It's a 3d sliver of 4d space at a distance of 1
      Toying around with higher dimentional spaces can tell you a lot about the trivial (1d, 2d, 3d) spaces and can change how you think about the ordinary world :)

  • @johneysteel525
    @johneysteel525 Год назад +8

    This one is worth sticking around until the end. The distinction between Rotation and Scale vs Translate is news to me. My favorite part is your breakdown of Sheer and how you can view any translation as a Sheer in the higher dimension that is then brought back down.

  • @benzsuankularb130
    @benzsuankularb130 2 года назад +3

    Wow... This guy knows how student's mind works. Every school should replace boring math classes with these visual lectures...
    Great job @Pikuma!

  • @diegodemetillo5947
    @diegodemetillo5947 8 месяцев назад +1

    This is the best explanation I've seen so far. Thank you for using various methods of explaining the concept, especially the part where you just say that we add an extra row as a mathematical trick to achieve translation. I also love the step-by-step animation for the 2D translation on a 2D plane, where the 3rd dimension was just used for a shear transformation. This makes it easier to understand that the 4th dimension for 3D translation is more of just an "imaginary"/hidden shear transformation from our perspective as 3D beings who can't see the 4th dimension. You deserve more subs.

  • @dzgames725
    @dzgames725 2 года назад +4

    Hands down the best explanation on this topic I have found so far. Thanks!

  • @Tupiniviking_de_osasco
    @Tupiniviking_de_osasco 4 месяца назад +1

    Gustavo, I'm not in the field of games or graphics, but your content is so amazing that I'll take some of your courses. Your explanation about numerical integrators was so clear, and now I saw this one about matrix transformations, wow simply amazing.

    • @pikuma
      @pikuma  4 месяца назад +1

      Welcome to the dark side. 😅

  • @kristianwichmann9996
    @kristianwichmann9996 3 года назад +5

    I think it *is* the most awesome thing I've seen this week. Good stuff, Gustavo

  • @toninotonnato7776
    @toninotonnato7776 Год назад +1

    Ok this is the coolest explanation of the 4D matrices application I ever heard. Just amazing.

  • @HartleySan
    @HartleySan 2 месяца назад

    At first, I didn't know where you were going with the shearing, but you blew my mind there at the end. Bravo!

  • @hericklenin
    @hericklenin 2 года назад +1

    Indeed, this is the coolest thing I have seen this week.

  • @Seiffouri
    @Seiffouri Год назад +1

    16:30 mins blown 🤯 after all these years finally I got the Ah moment! Thank you.

  • @adygombos4469
    @adygombos4469 2 года назад +1

    this is one of the best videos on matrices i've ever seen

  • @marcuscazzola4005
    @marcuscazzola4005 2 года назад +2

    Thanks! I have had such a hard time, understanding 4x4 Matrices. They were like a black box for me. But now, you put a smile on my face, because now I have a bit more understanding of the black box!
    I now need to look into the rotation and scaling part of the 4x4 Matrix.

  • @spudtaters8419
    @spudtaters8419 7 месяцев назад +1

    The 3d shear of a 2d shape was brilliant. Thanks.

  • @javedakhtar1435
    @javedakhtar1435 Год назад +1

    had been looking for something like ur channel for weeks now, ur a god sent

  • @tedsheridan8725
    @tedsheridan8725 Год назад +1

    Glad I watched to the end - the higher dimension shearing part made everything click. I'm working on a series of videos showing how to visualize the 4th dimension, this gives me another application to consider. Thank you!

  • @Anskair
    @Anskair 10 месяцев назад +2

    It is indeed the coolest thing I've heard in a week!

  • @jewcy2560
    @jewcy2560 Год назад +1

    Bro thank you so much. I spent hours trying to solve the math for this matrix-vector multiplication and then I find this video. This video allowed me to grasp the knowledge for my computer graphics class and I appreciate your time and effort in making this video. Your a life saver and just wanted to give my thanks :)

    • @pikuma
      @pikuma  Год назад +1

      My pleasure

  • @mrkotfw
    @mrkotfw Год назад +3

    Extremely well explained. Thank you.

  • @takanu
    @takanu 3 года назад +1

    Beautiful explanation, it's so rare to find accessible mathematics tutorials so thank you!

  • @princedeka6054
    @princedeka6054 3 года назад +1

    Damn bruh 😊 You got a new subscriber !!! This is the coolest thing i heard in this whole year

  • @martinmartinmartin2996
    @martinmartinmartin2996 Год назад

    Gustavo Pëzzi: THank you for such excellent description of 3d graphcs !
    I spent some time to learn matrix manipulaton on line , to understand how and why matrices work .
    Your explanation then made, the math 3d graphics understandable.
    I marvel at the complexity of 3d graphics and I am in awe of the results the 3d games, and drawings have produced.
    Only dozens (hundred? ?) of very sharp , artistically talented, programmers could produce such work.

    • @pikuma
      @pikuma  Год назад

      I find that, once we grok the fundamentals of how things work, we see beyond the magic and things start to make a lot of sense. 🙂

  • @tinkuzen
    @tinkuzen 2 года назад +2

    Gustavo You are amazing , I cant explain how easy you make things to understand . I have bought all the courses in Pikuma , since I am very fascinated about the way computers work and am very glad I have put my trust in the right hands . Thank you ..

  • @lodgechant
    @lodgechant 3 месяца назад

    Yay indeed! I've only recently discovered matrices and now just stumbled onto your video: it's so clear and helpful - thank you!

  • @randomdudely
    @randomdudely Год назад +1

    This IS the coolest thing I heard this week!

  • @AinurEru
    @AinurEru 3 года назад +3

    Note that already in the 2D shear illustration, the top and bottom edges of the shape is already being "translated" horizontally(!) As in, their 2 vertices move together - the edges maintains their size and shape. Right there already there's a clue: A shear applies a tanslation in a lower dimention (sub-space).
    Meaning, a 2D shear applies a 1D translation, to any line perpendicular to the axis being sheared. If we skew the Y axis, then any X-axis line that existed before, just slides sideways as-is (without scaling or rotating).
    Then, when going to 3D, skewing the Z axis applies a 2D translation to any XY plane that existed before the shear - it moves any plane sideways and/or back/front, again without any additional transformation within that plane (no scaling or rotation) - just moves as-is.
    Lastly the same can be envisioned to happen when skweing the W axis, applying a translation to any XYZ volume, again without any additional transformation within that volume (no scaling or rotation) - just moves as-is.

  • @buysmartter
    @buysmartter 2 года назад +1

    It is the coolest thing I heard this week. Thanks. After first part I finally understand it, but after second part - I will never forget it!

  • @reng7777
    @reng7777 2 года назад +1

    CLEAR,CONCISE AND PERFECTLY EXPLAINED!! GOOD WORK !!

  • @peterlous853
    @peterlous853 3 года назад +1

    I can recommend the 3d computer graphics course! One of the best out there!

  • @dlgkor
    @dlgkor Год назад +1

    Thank you for the explanation. I finally understood why we need 4x4 matirx. Amazing Video.

  • @WomboBraker
    @WomboBraker 13 дней назад

    damn i have to drop this comment praising how valuable this is. Amazing, truly amazing that you take your time to explain this

  • @breakdancerQ
    @breakdancerQ 11 месяцев назад +1

    Very nice explanation, definitely didnt look at the from the sheering side like that!

  • @sdx1969
    @sdx1969 8 месяцев назад

    Amazing !!. Being creative in explaining and visualizing the problem. It almost sounded like a layman terms for someone like me to finally comprehend the concept. Very grateful mate.

  • @willardpeng5941
    @willardpeng5941 25 дней назад +1

    Thank you. Very clear explanation.❤

  • @fredbcruz
    @fredbcruz 3 года назад +1

    I love this concept of buffer dimension.

  • @kirillholt2329
    @kirillholt2329 Год назад

    this was very clear, this vid deserves more attention

  • @RedRaion3
    @RedRaion3 3 года назад +1

    This video deserves more credit!

  • @sidekick3rida
    @sidekick3rida 2 года назад +1

    That was a very intuitive explanation for homogeneous coordinates. Thank you!

  • @bowenlin1481
    @bowenlin1481 8 месяцев назад

    This explanation is awesome! I never thought of translation in terms of shearing on the n+1 dimension. You cannot perform 3d translation using 3d linear transformations but you can perform 3d translation using 4d linear transformations. Thanks, for the awesome video.

  • @rush5900
    @rush5900 2 года назад +1

    Thank you very much, this will be very helpful.

  • @catpokerlicense
    @catpokerlicense 10 месяцев назад

    A shear in 3d is a translation in 2d. Thats such a beautiful way to think about it

  • @exogeo
    @exogeo Год назад +1

    Superb Explanation!

  • @adarshramtripathi7748
    @adarshramtripathi7748 7 месяцев назад

    I mean it's really crystal clear explanation.

  • @Corninthesky
    @Corninthesky 2 года назад +1

    Thanks dude, I learned some of this in my linear algebra class but this video really clarified things and solidified my knowledge :)

    • @Corninthesky
      @Corninthesky 2 года назад

      Also, is it all right if I use some screenshots from this video for a school project? I would give credit, of course.

  • @GrandHighGamer
    @GrandHighGamer Месяц назад +1

    3D acceleration really is wild, when you consider that moving your mouse cursor is actually shearing a 2D rectangle in 3D space through a 4th spacial dimension before it all gets projected back down into 2D.

  • @blackeye2312
    @blackeye2312 Год назад

    subbed becuase this is the coolest thing i have seen this week :')

  • @francisgagnon341
    @francisgagnon341 Год назад +1

    I will get the course! Thanks for your super relevant work!

  • @guilhermecampos8313
    @guilhermecampos8313 Год назад +1

    Wow, the shear explanation was very good!

  • @Dr.RokiaAbdein
    @Dr.RokiaAbdein 3 месяца назад +1

    it helped me a lot, thank you so much!

  • @Ares9323
    @Ares9323 Год назад

    The 3D shearing was mind blowing 🤯

  • @CuriousCyclist
    @CuriousCyclist 11 месяцев назад

    I've just discovered your channel. Great video. Thanks for taking the time to make it. You are a good teacher.

  • @xaviergonzalez5828
    @xaviergonzalez5828 Год назад

    I'm not a game developer, but I love your videos!

  • @elhalmihamza28
    @elhalmihamza28 Год назад

    it's the cooler thing in this week-end🤗

  • @wuhaipeng
    @wuhaipeng Год назад

    Thank you once again! It's fascinating to consider that shearing in (n+1) dimensions leads to translation in n dimensions, and that they are equivalent when viewed from an n-dimensional perspective!

  • @parinamais
    @parinamais 2 месяца назад

    this is amazing, you are a great teacher!! ty

  • @namdao2672
    @namdao2672 3 месяца назад

    now it all make sense thanks to you

  • @DKtruster
    @DKtruster 2 года назад +1

    Finally understood this. Thanks for explaining

  • @olitworkowski
    @olitworkowski 21 день назад

    I love u omg. Best lecture abput homogenous coordinates

  • @Dr.RokiaAbdein
    @Dr.RokiaAbdein 3 месяца назад +1

    OMG this is great! thanks a bunch

  • @wkxvii
    @wkxvii Год назад +1

    Excellent video mate!!
    Thank you very much for that

  • @MohamedHassan-iq6rk
    @MohamedHassan-iq6rk 2 месяца назад

    COOLEST thing heard this Year ♥

  • @sidekick3rida
    @sidekick3rida 26 дней назад

    What a beautiful concept

  • @ynsam
    @ynsam Год назад

    Man that was eye opening for me!!!

  • @orangasli2943
    @orangasli2943 2 года назад

    @6:57
    I saw in other people's video..
    They implemented the coordinate system( with x,y,and z coordinate as vector or in the context of programming as object)..
    He multiplied a 1x4
    (1 by 4 matrix for x,y,z,1)
    With a 4x4
    (4 by 4 transformation matrix)
    So the output is 1x4 matrix instead of 4x1 matrix like in this video

  • @ethanhalprin
    @ethanhalprin 2 года назад +1

    Great video! Very explanatory and clear.

  • @yolamontalvan9502
    @yolamontalvan9502 6 месяцев назад

    Very good information. You forgot to mention the name of the software used to make your amazing 2D and 3D graphics. Thank you.

  • @Indik47
    @Indik47 8 месяцев назад

    an awesome explanation. Thank you!

  • @dmytrogladkyi
    @dmytrogladkyi 2 года назад +1

    the best video on youtube

  • @davidadewoyin468
    @davidadewoyin468 2 месяца назад

    Just an awesome explanation

  • @krum3155
    @krum3155 2 года назад +2

    Couldn't you use a 3x3 matrix for a rotation and scale and simply add to the components for translation? Why do you need a matrix for translation?

  • @Imetalh
    @Imetalh Год назад +3

    I feel like thanos already hahaha

  • @acho8387
    @acho8387 2 года назад +1

    Nice. Very cool explanation, thanks!

  • @AmaanHasanDilawar
    @AmaanHasanDilawar Год назад +1

    Yhis is what I was looking for...

  • @martinmajewski
    @martinmajewski 7 месяцев назад

    Another way of explaining why 3x3 isn't sufficient might be this: the only way to move the X, Y, and Z components in space is by multiplying a factor to them. This factor would be on the diagonal line of the 3x3 matrix. So, e.g., if you want to move X by its double distance, you must calculate 2x+0y+0z. You can generally simulate an addition by multiplication if you know the correct factor. However, what do you do when X, Y, or Z is zero in the first place? No factor would ever change, aka. translate that component because factor times zero stays zero.
    Yes, this is the basis for "linearity." Still, I think it makes arguing in favor of the fourth dimension so much easier as you have an exception, which makes the feasibility of a 3x3 matrix break immediately.

  • @repkins
    @repkins Год назад +1

    Mind-blowing! Thanks.

  • @bmariani52
    @bmariani52 Год назад

    Gustavo, Clear, concise, to the point. Impressive imaging that make the explanation intuitive. Could you add a "List of Points" for the 3D Jet. I would like to program the rotation of the Jet Points based on your explanation. Thanks. Bert Mariani

  • @dylandang
    @dylandang 2 года назад +1

    that is such a good explanation! so cool

  • @jermaineallgood
    @jermaineallgood 10 месяцев назад

    THANK YOU!!!! This was so helpful…

  • @floxhoa
    @floxhoa Месяц назад

    Clear explanation 👍

  • @duarteribeiro1520
    @duarteribeiro1520 2 года назад +1

    Amazing!

  • @KrarupJakob
    @KrarupJakob 2 года назад +1

    Thanks for this great explanation! 😊👍

    • @pikuma
      @pikuma  2 года назад

      Thank you for the support. 🙂

  • @wuhaipeng
    @wuhaipeng Год назад

    Thank you for the clear explaination!

  • @tjalferes
    @tjalferes Год назад

    Very cool and very good teaching style. Thank you.

  • @adsurbum
    @adsurbum 8 месяцев назад +1

    Amazing. I just finished to watch the amazon video series "essense on linear algebra" by 3Blue1Brown, and came across here to see wonderful practical application. Sheering in 4 dimensional space... mind blowing

  • @emre5437
    @emre5437 2 года назад +1

    Thats great explanation i have ever heard thank u

  • @ibrahimhefny2494
    @ibrahimhefny2494 2 года назад +1

    what’s an incredible and interesting explain!!

  • @dumdum7099
    @dumdum7099 11 месяцев назад

    I don't see any mathematical problem with using 3x3 matrix to do translation.
    Addition can most definitely be represented with multiplication.
    x' = x * ((x+n)/x)
    n is for translation value
    So if you want move 3 steps
    7 * ((7 + 3)/7) = 7 * 10/7 = 10
    You can do this with any number.
    It's messy but it's doable.
    I think the main reason we use 4x4 matrix is because the problem of translation in perspective projection.

  • @user-wy6th3fb3k
    @user-wy6th3fb3k 6 месяцев назад +1

    amazing thank you!

  • @mike1hav
    @mike1hav Год назад

    Amazing video. Thankyou!!

  • @bschwand
    @bschwand Год назад +1

    it was rather customary before to simply use a 3x3 matrix for rotation and scaling, then adding a vector for translation.
    With older constrained systems, that was more efficient memory and computationally-wise. Obviously with current hardware performance, it's better and more flexible now to use quaternions and 4x4 matrices.
    I mean, I remember as a kid working out the trigonometry to project a 3D point on the screen 2D plane, and translate, rotate and scale, before I learned about matrices...
    Obviously 4x4 matrix calculation is much more elegant and simple.
    I guess it's like learning about the Laplace transform and complex numbers, instead of awful non-linear equations :-)

  • @user-wt2sg8kg1x
    @user-wt2sg8kg1x 2 месяца назад

    great explanation

  • @Lu1stron
    @Lu1stron 5 месяцев назад

    coolest thing I have ever heard