The Math behind (most) 3D games - Perspective Projection

  Рет қаралды 412,508

Brendan Galea

Brendan Galea

Күн бұрын

Пікірлер: 276
@BrendanGalea
@BrendanGalea 3 жыл бұрын
For those of you who have been following the vulkan tutorial series, this video is a slight departure from the normal format. The coding portion for the tutorial will be released separately as soon as I’m finished. Future tutorials will return to the more typical structure, with code and theory interleaved. Enjoy!
@yaircambordamorocho4506
@yaircambordamorocho4506 3 жыл бұрын
i loved the Homogeneous Coordinates Hero 😂
@BrendanGalea
@BrendanGalea 3 жыл бұрын
@@yaircambordamorocho4506 hahaha thank you :)
@y.m.o6171
@y.m.o6171 3 жыл бұрын
I really like the way you explain the theory behind these computer graphics topics without mudding with the programming part.
@acidev
@acidev 3 жыл бұрын
Amazing design of video, very accessible and interesting explanation, thanks a lot.
@dexterman6361
@dexterman6361 3 жыл бұрын
Crystal clear as usual! Now I know what z-fighting really means! Take that wikipedia!
@func8211
@func8211 3 жыл бұрын
Cleanest description of the math behind view projection I've seen! Nice.
@Enaku
@Enaku 3 жыл бұрын
Agreed! I've been reading and watching almost everything I can find on the topic and this is by far the best explanation I've seen to date.
@NoahDove-ei8in
@NoahDove-ei8in Жыл бұрын
WHAT THE FUCK IS HAPPENING GOD HELP THE MATHS IS HELL, KILL ME NOW.
@skuminator
@skuminator 5 ай бұрын
I cannot agree more, even though I had studied it before I had forgotten so many details and was struggling to find the derivation. In most books they just magically give you the projection matrix solution and give you two phrases, so hard to get it go from the basic n*(x/z) etc to the final form.
@ammonwolfert
@ammonwolfert Жыл бұрын
I’m writing a rendering engine from scratch in C and this was exactly the resource I was looking for. Wonderful visualization and explanation!
@Stratelier
@Stratelier 11 ай бұрын
I remember, when first learning programming I tried to get (any level of) 3D rendering to work, and discovering the math of perspective transformation (e.g. x1/z1 = x2/z2, thus x(screen) = x(world) * (z1 / z2) ) was a critical breakthrough. Even if the only thing I could actually code with it was an imitation of the "starfield" Windows screen saver.
@mackaygrange3072
@mackaygrange3072 6 ай бұрын
I’m working on the same project with SDL and quaternions right now and it has been a whole rabbit hole to dive into!
@alexanderheim9690
@alexanderheim9690 2 жыл бұрын
After watching 3blue1browns "Essence of Linear Algebra" Playlist, taking the linear algebra module in my university AND watching this video I was finally able to implement these concepts all while deriving the used methods by myself too. Thanks for this awesome video
@BrendanGalea
@BrendanGalea 2 жыл бұрын
Thank you!! glad you found it helpful!
@donutbedum9837
@donutbedum9837 3 ай бұрын
amazing playlist and this video is great too, i use it to understand layers in neural networks
@tomatrix7525
@tomatrix7525 3 жыл бұрын
This is very very very good. I’ve seen too many people code in opengl etc without really understanding what is going on. Sure it works, but this intuition as to what these matrices are doing is good
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Thank you!
@guitarvoicing
@guitarvoicing Жыл бұрын
Another master piece of 3d explanation. I really never understood well the black magic of the perspective matrix. It was in somehow just diving by z. Yet, your explanation is so clean and so perfect. It makes it really easy to understand. Please post more tutorials like these. You should definitely write a book about it too.
@bellanthea
@bellanthea 2 жыл бұрын
Thank you for this video!! I don’t code much, but I love art and math and was so curious on the math behind game engines / 3d graphics and wanted to see how close or far off my guesses were. this makes me want to code!
@BrendanGalea
@BrendanGalea 2 жыл бұрын
Thank you so much. Comments like this are what keeps me motivated to keep making videos.
@burakcanik01
@burakcanik01 5 ай бұрын
This, along with Cem Yuksel's 3D Transformation video really explains the subject well. I've reviewed this subject multiple times throughout the years but I gotta say, this 2-step approach (perspective projection = perspective transformation + orthographic projection) is IMHO the most intuitive and easy to remember way of teaching/studying this subject. Most books/resources tend to focus on deriving the perspective projection matrix from the ground up, often times skipping the inherent connection to orthographic projection. Thank you for a job well done. Cheers!
@ChadyLatifi
@ChadyLatifi 4 ай бұрын
do u mind asking is this the concept of converting 3d images to 2d images that appear on our displays(i just started learning about this subject for a school project)
@shailmurtaza9082
@shailmurtaza9082 Ай бұрын
@@ChadyLatifi You need to learn about perspective or orthographic projection.
@PBrrtrn
@PBrrtrn 2 жыл бұрын
Absolutely loved this explanation and would recommend it to anyone trying to understand the nuts and bolts of graphics programming.
@Skeffles
@Skeffles 7 ай бұрын
Brilliant video. I did a computer graphics course a few years ago and we never actually went into what makes the matrix. Thanks for explaining it!
@zdspider6778
@zdspider6778 Жыл бұрын
12:33 The vertical FOV is actually the angle from the center to the top (or center to the bottom, same thing). It's a half angle. Hence the theta/2.
@everestgjonaj
@everestgjonaj 7 ай бұрын
Also the the height he marks at the illustration should be height/2.
@grahaml6072
@grahaml6072 5 күн бұрын
You can define however you like but it is typically from top to bottom.
@stef8776
@stef8776 Жыл бұрын
I’m working on a career change right now, going back to school in the near future for an MS in CS with hopes to be a graphics engineer. I’m reviewing all the prerequisite math right now so having an understanding of what kind of math I’ll need to learn in the future is very helpful. Even though I didn’t really understand 95% of this it was still a great video 😁
@BrendanGalea
@BrendanGalea Жыл бұрын
Thanks and best of luck with your studies!!
@codejunki567
@codejunki567 Жыл бұрын
Just a question, do you have relevant CS or math experience? Because just going "I want to program 3d space vectors" is not something the average Joe just gets up and does?
@stef8776
@stef8776 Жыл бұрын
@@codejunki567 no I don’t, that’s why I’m going back and taking all the prerequisites before doing the grad program. I have to do calc 1, 2, linear algebra, physics, C++ programming, etc. I’ve done a lot of Python, R and SQL but that’s not really relevant. Believe me, I understand how difficult is and how much I have left to learn. I probably won’t be able to start the grad program for another year and half or so.
@Dom-zy1qy
@Dom-zy1qy 11 ай бұрын
​@@stef8776honestly if it's something you're interested in it's not very difficult. I think people who complete certain qualification programs try to oversell it's difficulty. As a complete average Joe myself I haven't really had problems with the maths side of 3d graphics. It's actually helped me improve my intuitive understanding of certain concepts. If you enjoy the work, you'll be thinking about it enthusiastically when you're out and about, going on a walk, doing whatever. When things are on your mind out of pure intrigue, you are probably in the right field and will definitely succeed.
@user-fy4iq6if4z
@user-fy4iq6if4z 2 жыл бұрын
Man you saved my life. I was cramming my 3D book and completely lost in projection stuff then found your vid. Thank you so much aa
@الإسلامدينالحق-خ5ت
@الإسلامدينالحق-خ5ت 2 жыл бұрын
My friends, search for your life purpose, why are we here?? I advise you to watch this series and this video 👇 as a beginning to know the purpose of your existence in this life kzbin.info/aero/PLPqH38Ki1fy3EB-8xmShVqpbQw99Do2B- kzbin.info/www/bejne/bZWUZ3amjNVgpc0
@RogerValor
@RogerValor 10 ай бұрын
never knew there is even so much more math beyond the math that my simulation itself needs, but it finally explains a lot
@kipchickensout
@kipchickensout Жыл бұрын
This simultaneously looks easily and neatly explained and not understandable at all without an already pretty advanced level
@aaaakko139
@aaaakko139 7 ай бұрын
Even though I thought I had already understood this before I watched, I still learn something from it. Thanks for making this video, I think it's the clearest one about how to get the Perspective Projection
@lavz24
@lavz24 2 жыл бұрын
Found this, Great explanation this topic was killing me, I was not able to understand it before where they get the values and a visual representation of it. You have everything. Great job!
@pedro_soares_bhz
@pedro_soares_bhz 6 ай бұрын
Wow, these drawings are so cool, they have a 2000's vibe. Nice.
@isshintheguy4172
@isshintheguy4172 11 ай бұрын
I have exactly no background in computer graphics, only linear algebra. Your video is masterful in its explanation. I find the tempo of your speech helps alot!
@ssopkc_venom
@ssopkc_venom Жыл бұрын
Probably the best in depth tutorial i have ever seen on KZbin for graphics rendering. Even better than Cherno IMO
@AlexGomes09
@AlexGomes09 2 жыл бұрын
Beautiful, right to the point. Not a lot of extra theory. Easy to follow and understand. Keep them coming 🙏
@rootKLM
@rootKLM 3 жыл бұрын
Two videos in a week! So glad you're making this series, I was struggling a lot with the vulkan documentation before I found your videos!
@zarblitz
@zarblitz 9 ай бұрын
This video on its own is incredible, educational, and just all around superb. I learned so much and tied together so many loose ends I had dangling in my brain because of this video. Thank you.
@sardaou3944
@sardaou3944 Жыл бұрын
The best mathematical explanation. In most cases, the equations come out of the blue like from the magician's hat. Thank you very much
@KamiSlayerz
@KamiSlayerz 3 ай бұрын
Thanks a lot! I've never heard these concepts explained so well!
@theRPGmaster
@theRPGmaster 3 жыл бұрын
Thanks again for continuing the series! I have something important (potentially) to add about future 3D animations: the cube demo ran poorly for me, low framerate, creating an ugly jitter. Unusual, since my hardware is fairly fast. Fixed it by disabling the "apidump" layer I had defined in the "VK_INSTANCE_LAYERS" system environment variable. However, this made my framerate skyrocket to above 3000 FPS, making the spinning cube become an imperceivable blur. Your demo implementation is framerate dependent, I have since created a lightweight way to measure timing (delta) and adjust the speed of animations to any system. Just thought I should remind you of this just in case. I can provide my implementation if you'd like to use it. Edit: having apidump enabled will not only slow you down, but also spam the console on every api call. Hope it helps. Sorry for the long post!
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Ya this is something I should have mentioned. The easiest way to limit frame rate for now is update the chooseSwapPresentMode function in the swapchain by commenting out the mailbox present mode, and using FIFO (vsync). Your solution is the ultimately correct one, where the game loop needs some timing mechanism. We'll cover the different methods of game loop timing pretty soon.
@madelinevandergriff2408
@madelinevandergriff2408 3 жыл бұрын
Time to drop everything for the new Brendan Galea video, love your stuff man!
@gvcallen
@gvcallen 3 жыл бұрын
Honestly I've probably watched this video around 4 times. Best explanation on the topic and a super good reference to hold on to. Thanks a lot!
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Wow, thanks!
@abdelmajidkansoussi6904
@abdelmajidkansoussi6904 7 ай бұрын
The best explanation of perspective projection. Thank you
@tomaszstanislawski457
@tomaszstanislawski457 2 жыл бұрын
I think that both OpenGL and Vulkan use right-handed coordinate axis. The coordinates just differ by rotation by 180 degrees around x axis.
@Enaku
@Enaku 3 жыл бұрын
Brendan, you're a gem.
@BrendanGalea
@BrendanGalea 3 жыл бұрын
thank you :)
@janoskovacs9406
@janoskovacs9406 3 жыл бұрын
Thank you very much! I needed to rewind parts of the video to fully digest the idea, but finally i did. :) Please, keep up the quality work!
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Ya Ive gotten some good feedback that maybe I went a little fast 😅 but really glad you were able to get it! This has definitely been the hardest video for me to make so far
@mrshodz
@mrshodz 2 жыл бұрын
great explanation. i love the visuals; it makes it so much easier to understand.
@BrendanGalea
@BrendanGalea 2 жыл бұрын
Thank you!! this was definitely the hardest video I've yet to make.
@jemmrich
@jemmrich Жыл бұрын
Just wow. Fantastic explanation!
@MKULTRA_Victim_
@MKULTRA_Victim_ Жыл бұрын
Currently learning basic math, but I watched this whole video for some reason and I really hope that someday I can understand it.
@Josh-kh1zp
@Josh-kh1zp 3 жыл бұрын
This is amazing!! I always wondered what was behind it, great Job!
@robertomontalti3064
@robertomontalti3064 Жыл бұрын
I don't know why, but every explanation online of how and why the z order is preserved ends up in a shady and not very explanatory way. At 10:35 you literally made me get it instantly! thank you for this great content, keep it up brother!
@Ryco117
@Ryco117 3 жыл бұрын
Thank you very much for making this quality tutorial series, I've been following along slowly for some time and really appreciate the detail and clarity. I will say that, for me personally, the videos which focus more on the mathematical background are less useful, but I may not be representative of the audience; just thought the feedback could be useful. Looking forward to more lessons!
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Thank you! And I appreciate the feedback. It's good to know what's working for some people and what isn't. Well, some good news then is this is the most math heavy video for the foreseeable future. Tutorial 14 will have just a bit more and then it's predominantly coding after that point.
@dexterman6361
@dexterman6361 3 жыл бұрын
@@BrendanGalea Might wanna do a poll, I enjoyed this video! Helps me understand why I put in a matrix, without blindly copy-pasta-ing it :) I personally prefer both!
@BrendanGalea
@BrendanGalea 3 жыл бұрын
@@dexterman6361 - ya that's a good idea. Something I'll have to think about
@الإسلامدينالحق-خ5ت
@الإسلامدينالحق-خ5ت 2 жыл бұрын
My friends, search for your life purpose, why are we here?? I advise you to watch this series and this video 👇 as a beginning to know the purpose of your existence in this life kzbin.info/aero/PLPqH38Ki1fy3EB-8xmShVqpbQw99Do2B- kzbin.info/www/bejne/bZWUZ3amjNVgpc0
@krumss
@krumss 3 жыл бұрын
Very well explained!! Good work!! Look forward to your game engine and computer graphics series!!
@Karmush21
@Karmush21 10 ай бұрын
Thank you so much for this video! Finally made me understand the perspective projection matrix
@aj-uo3uh
@aj-uo3uh 2 жыл бұрын
This is actually a general derivation that holds for a skewed view frustrum. The picture shows a regular frustrum. Skewed frustra you need when you want to make a huge picture so that you have to chop up the initial regular frustrum.
@mohsinmd2662
@mohsinmd2662 3 жыл бұрын
so clear and crisp. Thanks for this video
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Glad you liked it!
@allesfresser0
@allesfresser0 3 жыл бұрын
This channel is just awesome! Thank you so much.
@soolydooly1234
@soolydooly1234 11 ай бұрын
finally a tutorial that actual explains the maths
@reengineer2497
@reengineer2497 Жыл бұрын
thank you so much for the explanation. thanks to you I also understood new things about z-fighting.
@samarthtandale9121
@samarthtandale9121 Жыл бұрын
Nice Explanation video !!! Somehow I had to watch in 2x to not get distracted and understand better
@philipbutler
@philipbutler Жыл бұрын
homogeneous coordinates swooping in lmao. Great video! I've been meaning to understand this better for about a year now and finally searched it up and I'm thrilled to have found this, perfect for my level.
@stellarmagic3316
@stellarmagic3316 Жыл бұрын
All that Math Library Programmed in the Engine is Insane. Layers and Layers of Codes writing New Codes to render the output, Just like Neural Network!
@leiwang1566
@leiwang1566 2 жыл бұрын
It's very useful and eay to understand, thank you for your work.
@Lazullien
@Lazullien 2 жыл бұрын
this is the type of stuff you understand when you're learning it, but when you're programming it makes you wanna die
@BrendanGalea
@BrendanGalea 2 жыл бұрын
Hahaha ya exactly. The main problem is that you rarely get useful error messages as feedback. Things will just look wrong. My first school project working on projection matrices I was passing in the matrix in row major order and didn’t realize OpenGL wanted column major… took me hours to figure that one out
@BobrLovr
@BobrLovr 10 ай бұрын
@@BrendanGalea any tips for getting my brain to actually work with all these different orderings? It's 99% of what i spend my time debugging in my brain
@Aurora12488
@Aurora12488 6 ай бұрын
This is almost the perfect derivation of perspective projection (especially since it includes both the off-axis and FOV versions!). However, I wish you would have talked more about why applying the first perspective transform gets us into a space that allows for trivially transforming with the orthographic projection matrix. It doesn't seem intuitive to me. Firstly, I think it would have helped to emphasize that multiplying by n and dividing by z actually turns the slanted edge of the frustum into the right-angled straight edge of the desired rectangular prism because everything on that will end up landing at the exact same x value (or y, for the top, respectively). Secondly, however, we should note that what we get after multiplying with our perspective matrix is *not* a 3D rectangular prism, since its components haven't been divided by the w component (i.e. z value) yet. It's a seemingly somewhat arbitrary 4-dimensional entity, and so it's unclear from my limited linear algebra skills why doing the perspective divide and then applying the orthographic projection is equivalent to doing the orthographic projection and then the perspective divide. There seems to be a deeper "truth" to homogeneous coordinate equivalence that is more than just a notational convenience. If you had touched a little on that, this would have been the de-facto, perfect explanation.
@Aurora12488
@Aurora12488 6 ай бұрын
Hmm, trying to figure it out more, it seems like the "divide-by-w" can really just be considered to be multiplying the matrix-vector multiplication by the scalar 1/w. And if you have a scalar a and a matrix-vector multiplication M times v, M[av] = a[Mv] (as well as [aM]v). I think that's the last piece of the puzzle.
@r.d.6536
@r.d.6536 11 ай бұрын
Wow, thank you so much for explaining these topics so well!
@animationmann6612
@animationmann6612 11 ай бұрын
This is a Beautiful Explanation
@xanderlinhares
@xanderlinhares Жыл бұрын
If you use the right-hand rule with X pointing to the right and Y pointing up, positive Z goes into the screen and -Z goes out. If that matches up, it is right-handed. Otherwise it is left.
@tokyospliff
@tokyospliff 3 жыл бұрын
That intro omfg 🔥🔥🔥🔥
@ajaykumar-qw3qr
@ajaykumar-qw3qr 2 жыл бұрын
Very nice and detailed explanation. Thank you for the video.👏
@BrendanGalea
@BrendanGalea 2 жыл бұрын
Glad it was helpful! Thanks!
@flameofthephoenix8395
@flameofthephoenix8395 Жыл бұрын
Great! I think I'll not watch it though; I've been for a few years just figuring this out mostly on my own, I don't really want to spoil anything for myself! I think I've figured out UV mapping or at least something akin to it, I figured that if you know which triangle a point is being projected from, then you can change the central point, in other words shift every 3d object's coordinates aside from Z position and reproject the point again, if you do this twice making sure that you're projecting to central positions such that the orthographic projection of the de-projected 3d point can't be on a line from the two 2d projected points, then you can now draw a line from the two projected positions to the point that was their central position, find the line intersection and you'll now have the X and Y coordinates of the de-projected point, all that's left is to simply figure the Z coordinate based on X and Y coordinates.
@Director414
@Director414 Жыл бұрын
Awesome video! Thanks a lot for this!
@salat_32
@salat_32 Жыл бұрын
I dont understand anything
@newstrangerX
@newstrangerX 6 ай бұрын
😂😂😂😂😂😂 you know why
@ankushroy1729
@ankushroy1729 6 ай бұрын
Skill issue
@dheerparekh1305
@dheerparekh1305 5 ай бұрын
Watch multiple videos explaining this topic... It helps
@sadiulhakim7814
@sadiulhakim7814 5 ай бұрын
Same
@vanci2039
@vanci2039 4 ай бұрын
🫂😂
@_general_error
@_general_error 3 жыл бұрын
Good explanation of the frustrum matrix... but I can imagine total newbies would not take much out of it, unless you show them some code and what effects can be achieved with manipulating the frustrum parameters. One thing which tripped me up is what are n and f values and how they are chooses... but this is probably just me not paying attention.
@tapewormerbinkosti3141
@tapewormerbinkosti3141 2 жыл бұрын
Except 1 thing that I don't understand: from the final output of perspective projection matrix, do you need to divide x and y by w from the final output of perspective projection matrix to get the correct x and y? Thanks for potential answer 😊
@hawns3212
@hawns3212 Жыл бұрын
No, in the shader when you set gl_position it will automatically divide by the w component.
@joaquinalvarez2830
@joaquinalvarez2830 Жыл бұрын
Amazing video but the "homogeneous coordinates to the rescue" part was what got me to click the button Like XD
@Sir_Pickle
@Sir_Pickle 2 жыл бұрын
Amazing again, was nice to get to some theory.
@الإسلامدينالحق-خ5ت
@الإسلامدينالحق-خ5ت 2 жыл бұрын
My friends, search for your life purpose, why are we here?? I advise you to watch this series and this video 👇 as a beginning to know the purpose of your existence in this life kzbin.info/aero/PLPqH38Ki1fy3EB-8xmShVqpbQw99Do2B- kzbin.info/www/bejne/bZWUZ3amjNVgpc0
@zilch.scienta
@zilch.scienta Жыл бұрын
THIS WAS SO AWESOME! Keep up the great work!
@ColonelJ1
@ColonelJ1 2 жыл бұрын
I'm a bit confused. In the first example, the origin "orthographic view volume" is in world-space? Therefore this is valid for a camera looking down the z-axis, but if you wanted to have a camera looking towards anywhere you would need to add a rotation matrix in there right?
@rutvikpanchal466
@rutvikpanchal466 3 жыл бұрын
New video, Awesome!
@emperor8716
@emperor8716 2 ай бұрын
i really just watched this entire video even though it felt like someone was rambling into my ear while i was daydreaming 😂
@mrshodz
@mrshodz 2 жыл бұрын
How does this matrix equation take into account the field of view? Also, how big is the frustum? What is the width and height of the near and far plane?
@aj-uo3uh
@aj-uo3uh 2 жыл бұрын
These can be calculated from l,r,b,t.
@simgamedev6423
@simgamedev6423 3 жыл бұрын
Thank you so much!
@openroomxyz
@openroomxyz 2 жыл бұрын
Thanks! Very good explenation.
@jungwisely1137
@jungwisely1137 11 ай бұрын
Great video, making LA way more interesting to me personally
@atibyte
@atibyte 4 ай бұрын
Nice explanation, thank you.
@void-fp9hq
@void-fp9hq 2 жыл бұрын
Thank you! Amazingly helpful video!!!
@karelknightmare6712
@karelknightmare6712 5 ай бұрын
So in the end the frustum matrix is simplified to a ‘pyramid’ matrix so that angles from the center are displayed with respect to their tangential value. Right? 😅
@DoctorOfMinecraft
@DoctorOfMinecraft 6 ай бұрын
how does the non linear z buffering effects the light calculations? or are they too small to care about?
@BrendanGalea
@BrendanGalea 6 ай бұрын
When doing light calculations you want to use the world space x,y,z values so the non linear z value (screen space) in the depth buffer does not play a role in the calculation. The z depth buffering value is only really used for determining which fragment is closest so only the ordering matters. However for some more advanced techniques such as screen space ambient occulsion or when using shadow maps the non linear z buffering does start to matter and is something that should be kept in mind. It’s a bit beyond the scope of a KZbin comment to be able to go into. But any good tutorial that depends on depth dependent information should cover how it is relevant in the context of the tutorials topic.
@torljungberger2486
@torljungberger2486 3 жыл бұрын
I think i finally get it! Thank you for this video
@florisvanderhout2675
@florisvanderhout2675 3 жыл бұрын
wow this is amazing thank you very much
@الإسلامدينالحق-خ5ت
@الإسلامدينالحق-خ5ت 2 жыл бұрын
My friends, search for your life purpose, why are we here?? I advise you to watch this series and this video 👇 as a beginning to know the purpose of your existence in this life.. kzbin.info/aero/PLPqH38Ki1fy3EB-8xmShVqpbQw99Do2B- kzbin.info/www/bejne/bZWUZ3amjNVgpc0
@pontosinterligados
@pontosinterligados Жыл бұрын
I have a 3x4 matrix obtained from a camera calibration method. The matrix includes the intrinsic and extrinsic of the camera but not really a model view projection matrix. How do I dare to convert this raw matrix into a 4x4 projection matrix?
@EnupGames
@EnupGames Жыл бұрын
But what's that?! It's homogeneous coordinates to the rescue! Love it!
@pavelperina7629
@pavelperina7629 Жыл бұрын
Interesting. I've tried to derive it using transform to ortogonal frustum first (far goes to one, near goes to near/far) and then solving equations to open the wedge and map right, near point to 1,0. One slight inaccuracy is z buffer precision. It's from times when z buffer was stored as fixed point number. Today it can be switched to floating point. Also range can be both -1 to 1 or 0 to 1 in modern OpenGL and z test can be negated.
@ntsakoselaule8646
@ntsakoselaule8646 3 жыл бұрын
Love your explanations man, you make the documentation easy S/o
@rocapbg9518
@rocapbg9518 2 жыл бұрын
Thanks, I was finally able to understand how all of these works. Only wish that you'd spend a bit more time explaining how we get the right, bottom and left coordinates with tangent.
@BrendanGalea
@BrendanGalea 2 жыл бұрын
ya i did kind of gloss over that. It's just by using some highschool trig. We know the field of view angle, aspect ratio and distance to the near plane. We make use of tan(theta) = opposite side length / adjacent side lenth. angle = field of view / 2 (since we want to form a right angle triangle with the near plane) opposite side length = height / 2 adjacent side length = distance to near plane the only unknown here is the height, so we can rearrange to solve for that. Once we have the height we can solve for the width since we know aspect ratio = width / height so the only remaining unknown is the width and we can rearrange to solve for that.
@UncoveredTruths
@UncoveredTruths 3 жыл бұрын
this is the video I wanted when i was in high school! unfortunately now i find this as a (qualified?) mathematician :P
@mediwise2474
@mediwise2474 Жыл бұрын
What type of mathematics to study to understand it
@joyceji6400
@joyceji6400 11 ай бұрын
Amazing video to learn 3d projection!!
@SreyRc
@SreyRc 3 жыл бұрын
Excellent video! Can't thank you enough!
@kodesafi
@kodesafi Жыл бұрын
I really really needed this video. Thank you !!!!!
@sto2779
@sto2779 Жыл бұрын
Nice, I can use these math for making LiDAR sensors.
@bubbango
@bubbango 3 жыл бұрын
In minute 6:04 you are describing that the sidelines of a triangle are proportional, but you are writing that y_s / n = y / z, when it should be y_s / n = y / (z + n) because the length of the bottom segment is z + n, and not only z, based con the viewer's angle. Wouldn't the calculations change a bit with this in mind?
@BrendanGalea
@BrendanGalea 3 жыл бұрын
The z in the diagram is meant to refer to the entire length of the bottom side of the orange triangle (6:02), not just the bit occurring past the near plane. But I can see how that’s confusing based on what I’ve drawn!
@anonymous-random
@anonymous-random 7 ай бұрын
This is a masterpiece. Thx!
@VolumetricTerrain-hz7ci
@VolumetricTerrain-hz7ci 8 ай бұрын
I like your video, but I have a question. In 3d video games with true perspective, a square is orthogonal to the distance to another square. But in the isometric video game, the rhombus is instead orthogonal to the distance to another rhombus. What would have happened if we enlarged one of the rhombus, so that it became true perspective, instead of isometric?
@AmaanHasanDilawar
@AmaanHasanDilawar 2 жыл бұрын
This is what I was looking for...thank you.♥♥
@romanshvayko211
@romanshvayko211 3 жыл бұрын
Amazing
@abdullahpatel2120
@abdullahpatel2120 11 ай бұрын
Right... Definitely understood what being said.
@mokshsurya1681
@mokshsurya1681 Ай бұрын
Can someone explain me from from basics image vs object and its relation with 3D geometry it seams like there should be some connection according to video.
@australianoz
@australianoz Жыл бұрын
One question, the vertical field of view as you display considers the view center point to be at Y = 0 and not at h/2, thus theta is incorrect in your statement, or did i miss something? (Coming from a bloke who used to have to draw these projections on paper back in the early 80's).
@blender6895
@blender6895 11 ай бұрын
thanks for great explaination
@user-dh8oi2mk4f
@user-dh8oi2mk4f 3 жыл бұрын
3:09 If it points into the screen, then shouldn’t it be pointing the other way?
@BrendanGalea
@BrendanGalea 3 жыл бұрын
Ya the drawing isn't exactly clear since I triedtilting things slightly of axis to be more visible. Making 3D drawings isn't easy for me lol +z should point into the screen. So starting from your nose to the screen in front would be the direction. And the -z points from the screen to the viewer
@andrey730
@andrey730 11 ай бұрын
Shouldn't Scale by Y axis be 2 / (t - b) instead of 2 / (b - t) at 4:45? Otherwise it will get negated. E.g. t = 5, b = 0 => 2 / (0 - 5) = - 0.4
@burgertron3193
@burgertron3193 2 жыл бұрын
I like how the video starts, but then it goes into Vulkan stuff when I'm just after the numbers.
@BrendanGalea
@BrendanGalea 2 жыл бұрын
Thanks! I tried to keep the vulkan stuff to a minimum but it is part of the tutorial series. But the theory aspects are pretty universal. Hope you still were able to find it useful!
@burgertron3193
@burgertron3193 2 жыл бұрын
@@BrendanGalea I think I got some useful information out of it? Still not sure what a matrix is though.
@emteiks
@emteiks 2 жыл бұрын
how different would be this perspective projection matrix for OpenGL ? it is having -z...z range so i assume it will be different on z component of the matrix
Projection Matrices - Vulkan Game Engine Tutorial 13
9:08
Brendan Galea
Рет қаралды 39 М.
How do Video Game Graphics Work?
21:00
Branch Education
Рет қаралды 3,9 МЛН
HELP!!!
00:46
Natan por Aí
Рет қаралды 34 МЛН
Flipping Robot vs Heavier And Heavier Objects
00:34
Mark Rober
Рет қаралды 61 МЛН
黑的奸计得逞 #古风
00:24
Black and white double fury
Рет қаралды 30 МЛН
When u fight over the armrest
00:41
Adam W
Рет қаралды 4,5 МЛН
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,5 МЛН
American was shocked by 7 Slavic countries word differences!!
15:29
World Friends
Рет қаралды 35 М.
In Video Games, The Player Never Moves
19:21
Josh's Channel
Рет қаралды 466 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,6 МЛН
Putting Algebraic Curves in Perspective
21:39
Bill Shillito
Рет қаралды 283 М.
Visualizing quaternions (4d numbers) with stereographic projection
31:51
I Trapped this AI Worm in a Dark Room for 1000 Simulated Years
10:05
HELP!!!
00:46
Natan por Aí
Рет қаралды 34 МЛН