Code-It-Yourself! 3D Graphics Engine Part #1 - Triangles & Projection

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 เม.ย. 2024
  • This video is part #1 of a new series where I construct a 3D graphics engine from scratch. I start at the beginning, setting up the project, then discuss vertices and triangles. Next a description of how 3D coordinates are converted into on-screen 2D coordinates using a projection matrix. This results in seeing a cube being rotated in 2-axis and translated.
    Source: github.com/OneLoneCoder/Javid...
    / javidx9
    / discord
    Blog: www.onelonecoder.com
    Twitter: @javidx9
    Twitch: javidx9
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 2.1K

  • @kakkoiichris
    @kakkoiichris 5 ปีที่แล้ว +1037

    With Visual Studio 2017, the old project options window shows up when you choose the "Windows Desktop Wizard" option.

    • @Ageekything
      @Ageekything 5 ปีที่แล้ว

      Nope same thing except now it throws an exception? Can I send you a screen shot?

    • @keilanknight8513
      @keilanknight8513 4 ปีที่แล้ว +7

      @@Ageekything use the wizard and unselect "precompiled header", also select "empty project" this way you just need to add an item (cpp source file) then you're good to go. Just come across this video now and ran into these same problems after upgrading visual studio! There's something dirty about needing to use a wizard! :)

    • @franklemanschik4862
      @franklemanschik4862 4 ปีที่แล้ว +1

      @@keilanknight8513 you do not even need to use such wizard I for example simply copy project folder structures into so called template projects then I can copy that folder rename it to my new project name and boom it works :D I can open it in any IDE

    • @vlazm1853
      @vlazm1853 8 หลายเดือนก่อน

      I have tried coding rotating square once. Took me way more time I want to accept...

  • @taba1950
    @taba1950 5 ปีที่แล้ว +1824

    -"don't click stop just yet"
    -I'm here for the math

    • @javidx9
      @javidx9  5 ปีที่แล้ว +241

      Lol thanks Almujtaba! Im pleased to hear some people are!

    • @fuzzycat3651
      @fuzzycat3651 5 ปีที่แล้ว +57

      If you aren't I would wonder if you really should be here!

    • @aradarbel4579
      @aradarbel4579 5 ปีที่แล้ว +5

      lol thats so true

    • @stanislavzoldak2198
      @stanislavzoldak2198 5 ปีที่แล้ว +6

      Came to the comment section to say this exactly.

    • @Luffi98
      @Luffi98 5 ปีที่แล้ว +6

      @@fuzzycat3651 I expected more literature but only found math, dissapointed :(

  • @iamthebubb
    @iamthebubb 4 ปีที่แล้ว +1511

    I once made a square that moved around using c++, it took me a week

    • @richarddukard8989
      @richarddukard8989 4 ปีที่แล้ว +463

      Next stop, red dead redemption 2

    • @blatrump
      @blatrump 4 ปีที่แล้ว +73

      @@username6338 So easy, that it's still the primary source of bugs in this language.

    • @obinator9065
      @obinator9065 3 ปีที่แล้ว +12

      Tompas Trupp yah even with RAII and smart pointers around.
      I’ve created custom allocators for my Game Engine that handle these problems for chunk loading etc.
      I still have leaks from time to time.
      There‘ll be a point in advanced Game Engines where ‚new‘ just isn‘t fast enough. The answer to that is Placement New, bug dangerous for sure.

    • @Odin_Borson
      @Odin_Borson 3 ปีที่แล้ว +7

      I csn do that in C with old graphics.h

    • @jebactychpolicjantow5497
      @jebactychpolicjantow5497 3 ปีที่แล้ว +16

      well if you don't know c++/c with classes too well that's not unimpressive given how shattered your view of arrays and data structures becomes when you move onto it from JavaScript.

  • @MrBranh0913
    @MrBranh0913 3 ปีที่แล้ว +324

    I’m a backend developer who has spent most of my career never dealing with anything related to games or graphics. But lately I’ve had a curiosity about the world of computer graphics. This is an awesome introduction. Not going to lie some of the matrix multiplication stuff requires a refresher for me, but this is super solid material.
    Despite coding for 20 years I feel like a total noob again learning programming for the first time.

    • @carloscepeda8663
      @carloscepeda8663 ปีที่แล้ว +22

      Same here, lol.
      In my case I'm really bored of programming /maintaining enterprise applications or making API's and nothing else.

    • @symbioticparasite6268
      @symbioticparasite6268 ปีที่แล้ว +9

      Your only doing a good job in I.T if you're feeling like a n00b....
      It's an infinite loop of knowledge my friend, from 0 to 1 and back again. Nobody knows all, that's why we specialise and collaborate!

    • @prtygrl5077
      @prtygrl5077 8 หลายเดือนก่อน +2

      you don't need matrix calculations or transforms. he just makes it looks like difficult. Trust me it just takes 15 or less lines of code without any kind of special scenekits or anything. may be he's too d!mb to think. Our eyes only sees anything around us 360 degree any angle, rotated 2d and then rotated 3d. Same can be implemented with simple code.

    • @helloworld4872
      @helloworld4872 8 หลายเดือนก่อน

      ​@@prtygrl5077I am a noob, we don't need to learn vector and matrix transform for game development ?

    • @deathbyslime6725
      @deathbyslime6725 5 หลายเดือนก่อน

      ​@@prtygrl5077prove it

  • @jeffreyg6850
    @jeffreyg6850 4 ปีที่แล้ว +170

    When I die... I want to come back as a line of Javidx9's code...

    • @Ghost-gj1bx
      @Ghost-gj1bx 4 ปีที่แล้ว +3

      @@MantasXVIII r/unexpectedmonkeyspaw

    • @officialsizzle5797
      @officialsizzle5797 3 ปีที่แล้ว

      I mean you don’t come Back but i still like what you would like to be 😂

    • @HalloGaming
      @HalloGaming 2 ปีที่แล้ว +5

      Alright you come back as:
      using namespace std;

    • @samljer
      @samljer 2 ปีที่แล้ว

      system("pause");

  • @amalirfan
    @amalirfan 3 ปีที่แล้ว +727

    I was trying to replicate this in python for past couple of hours, it finally worked.. That was soo satisfying 😄😄

    • @vilasd.chawan1769
      @vilasd.chawan1769 3 ปีที่แล้ว +22

      But how did you do that

    • @emmettdja
      @emmettdja 3 ปีที่แล้ว +35

      Im trying to replicate it in p5 js and I've almost got all the code transferred. Time to think about it as i sleep til tomorrow morning.

    • @vilasd.chawan1769
      @vilasd.chawan1769 3 ปีที่แล้ว +5

      @@emmettdja how do you do that ?

    • @emmettdja
      @emmettdja 3 ปีที่แล้ว +33

      @@vilasd.chawan1769 mainly the matrix multiplication is what is doing this. You can recreate this kind of math on almost anything.

    • @vilasd.chawan1769
      @vilasd.chawan1769 3 ปีที่แล้ว +9

      @@emmettdja ohh , but I didn't get that , as I am new to programming , and I have now only learned python 3 , and made only 3 super simple games

  • @Lennybird91
    @Lennybird91 4 ปีที่แล้ว +146

    As a Junior software engineer whose coverage of graphics consisted of one course utilizing OpenGL in college, I'm very grateful for this series. Exploring the underlying theory devoid of simplifying libraries is exactly what I'm after. Thanks!

    • @user-ri2ms2mm7w
      @user-ri2ms2mm7w ปีที่แล้ว

      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 th-cam.com/play/PLPqH38Ki1fy3EB-8xmShVqpbQw99Do2B-.html
      th-cam.com/video/7d16CpWp-ok/w-d-xo.html

  • @Okuhno
    @Okuhno 20 วันที่ผ่านมา +3

    I went through this series years ago, I ended up porting all the code in the series to lua, it legitimately broadend my horizons and general understanding of code and math, I just want to say thank you.

    • @javidx9
      @javidx9  20 วันที่ผ่านมา +1

      I'm pleased you found it useful. Thanks!

  • @felixmerz6229
    @felixmerz6229 3 ปีที่แล้ว +146

    I coded a 3d engine from scratch this year, without external code examples. Huge headache, but I got it done. Can't wait to see the hundreds of things I did wrong.

    • @lookupverazhou8599
      @lookupverazhou8599 ปีที่แล้ว +12

      That's one way to get good at something.

    • @tellahsage6477
      @tellahsage6477 ปีที่แล้ว +7

      Fucking cool man, wish i had the guts to do that. Most i've ever done was writing 2D platformers in pure C but never even wet my foot into 3D because bad at algebra and the like. I should pick up a math textbook and then try to do something like this after reading it, must be a rewarding experience once you actually see your code work.

    • @felixmerz6229
      @felixmerz6229 ปีที่แล้ว +9

      @@tellahsage6477 It was amazing when it worked for the first time. I've tried it a couple times in the past and never got it working just right or only under very specific circumstances. Obviously this version bugged out dozens of times, but when it suddenly worked, I was really happy.
      The math isn't the difficult part about it, I'm pretty much a forklift driver, so I'm no math person by any stretch of the imagination.All you have to do is understand the individual steps, put them to code, abstract it away and you can forget about it forever. I couldn't explain to you vector maths or even do it on paper, but I can write code that does it, and I'm certain you can, too.

    • @prtygrl5077
      @prtygrl5077 8 หลายเดือนก่อน +1

      yeah me too, I also made a 3d engine. This video su!ks though. he make it complex but it's not. Our eyes only sees anything around us 360 degree any angle, rotated 2d and then rotated 3d. Same can be implemented with simple code. just need cos tan and basic trigonometry.

    • @felixmerz6229
      @felixmerz6229 8 หลายเดือนก่อน +1

      @@prtygrl5077 No, that would cause constant gimbal locks.

  • @TheTukkia
    @TheTukkia 5 ปีที่แล้ว +275

    those pespective equations are things that make so much sense, but you will never think of unless you break the whole problem down really well. Nice job man, you make my geometry classes actually worth something

    • @javidx9
      @javidx9  5 ปีที่แล้ว +73

      lol thanks Talento, its surprising how much high-school maths has a practical value in programming!

    • @bonbonpony
      @bonbonpony 5 ปีที่แล้ว +5

      Yup, it all boils down to simple geometry of similar triangles ;)

    • @yan-amar
      @yan-amar 5 ปีที่แล้ว +52

      @@javidx9 What's surprising to me is how high school made all those useful maths uninteresting by not telling us it was actually useful somewhere in the real world.

    • @maythesciencebewithyou
      @maythesciencebewithyou 4 ปีที่แล้ว +19

      @@yan-amar Be honest, you never cared to know back then.

    • @nich.1918
      @nich.1918 4 ปีที่แล้ว +11

      @@maythesciencebewithyou that's literally what he's saying...

  • @wyleong4326
    @wyleong4326 3 ปีที่แล้ว +27

    1 minute in and I’m already loving this; graphics, maths, programming and art.

    • @PinkeySuavo
      @PinkeySuavo 11 หลายเดือนก่อน

      1 minute in and im out, too dumb for this. Only forwarded for end results.

  • @Wjw129
    @Wjw129 5 ปีที่แล้ว +722

    Finally, a programming tutorial where you cant hear the tutor’s saliva.
    Very helpful though so far, thanks so much.

    • @kenji1856
      @kenji1856 4 ปีที่แล้ว +17

      yes, I too am no longer educating myself because the person trying to teach me produce saliva in their mouth, and apparently I can hear it.

    • @kristypolymath1359
      @kristypolymath1359 4 ปีที่แล้ว +5

      Maybe if the teachers weren't buried in your lap....

    • @anisnej10
      @anisnej10 4 ปีที่แล้ว +7

      @@kenji1856 poor attempt at a verbose meme.

    • @onesubscriberbeforechallenge
      @onesubscriberbeforechallenge 3 ปีที่แล้ว

      no homo

    • @lightbulb8888
      @lightbulb8888 3 ปีที่แล้ว +2

      and the damn music

  • @jamesw242
    @jamesw242 5 ปีที่แล้ว +589

    You could charge for these vids.. But i appreciate you not doing. I'm on long term sick and your videos help me do something useful with my time and to better myself

    • @javidx9
      @javidx9  5 ปีที่แล้ว +216

      Hi James, I really appreciate what you are saying, and it pleases me because youve captured the essence of my entire OneLoneCoder initiative in one personal example. Thank you!

    • @starinsky2873
      @starinsky2873 5 ปีที่แล้ว +1

      @@javidx9 Thanks programmer!
      Matrix is useful though.

    • @bonbonpony
      @bonbonpony 5 ปีที่แล้ว +17

      @@javidx9 Those who charge for their courses apparently forgot how they learnt their stuff in the first place (from freely available resources). If they had to pay for their knowledge, they would most likely not have it today. Spreading your knowledge for free means that one day someone else will give you their knowledge for free too. And that's how this world should work. Unfortunately, I see that it is heading in the very opposite direction more and more every day ;/ (because of money-induced greed).

    • @bonbonpony
      @bonbonpony 5 ปีที่แล้ว +10

      @Trys10Studios You see, you fell into the same trap most people do, putting the cart before the horse, that is, money before the thing it is paid for. In a logical world, you would do something because you enjoy doing it, and if someone finds it useful, they reward you with some goods in return to support you and make sure you will do more of it. When you do it the other way around, that is, you demand money or else you won't lift a finger, you're planning your own disaster. Because then, if people don't want to pay you, you blame them for being unfair or ungrateful, or blame yourself / your product for not being good enough, etc. Money takes out all the fun from life, because now you're starting to "work for money", and if you don't get money, you start to think that it is pointless to do something that you would otherwise do with pleasure out of pure boredom :q If people worked that way all the time (that is, do nothing unless someone pays them), no one would ever invent anything, created any piece of art, etc.
      And if you think about it somewhat deeper and on a broader scale, who do we work for, really? We work for each other, exchanging money in circles. So why do we really need that money? Couldn't we just work for each other directly, without this additional burden? Well, we could. And we did, back then in the past, when barter was the only means of economy (as it is in nature in general). Originally, money was just another commodity that could be exchanged for other goods or services, because it had inherent value. But then the tricky banksters come up with an idea of forging fake money (bank notes) of no inherent value whatsoever and exchange them for real value on the market, draining all the goods from it and turning people into their clueless slaves. Now we don't really work for each other that much anymore - we work for THEM now, because when you track where all the currency (which is no longer true money) comes from, you will always end up in some bank. They created a system in which you HAVE TO work for them in order to get money for your life, otherwise they don't let you just live happily and do whatever you want.

    • @pubx2719
      @pubx2719 4 ปีที่แล้ว

      @@javidx9 How to create a game like yourself

  • @hoax-games
    @hoax-games 5 ปีที่แล้ว +29

    For the people that wonder about the z-values in the projection matrix: for linear scaling, to get z in the range 0 to 1 you need to: z'=(z-znear)/(zfar-znear). However it is recommended to have higher precision for lower z values (objects that are near to the camera) than for higher z values (objects that are far away). Therefore z' is multiplied by zfar and divided by z (== the given projection matrix z-values in the video just written differently). This is an important note to fully understand the math behind the projection matrix. Thx javidx9 for this awesome video. I for the first time finally understand how a projection matrix is constructed. Thx to you!

    • @javidx9
      @javidx9  5 ปีที่แล้ว +4

      No problem Kreshnik!

  • @summer_xo
    @summer_xo 2 ปีที่แล้ว +3

    javid invented computer science, video games, visual studio, 3d graphics and free world class tuition.

    • @javidx9
      @javidx9  2 ปีที่แล้ว +2

      That's quite a list... I don't recall inventing all those things, but I do appreciate the thought and support. Thanks Shane!

  • @Grandalf3004
    @Grandalf3004 4 ปีที่แล้ว +6

    Following along with this in java, and ive had no trouble keeping up so far. You're a great teacher. You're actually one of the only decent free teachers I've found. You're sitting down and telling me something in a language I've never even programmed in, and I understand it better than the guy using the same language as me and 15 more videos.

  • @Kazdro009
    @Kazdro009 5 ปีที่แล้ว +300

    11:49 Top 10 anime betrayals

    • @trevorthieme5157
      @trevorthieme5157 5 ปีที่แล้ว +7

      LOL I guess that would be true for programmers!

    • @TheBypasser
      @TheBypasser 5 ปีที่แล้ว +4

      Guess it should read "all I want is my program to become my own hell;", yet "using namespace std;" is shorter to type so they substituted it ;)

    • @TheBypasser
      @TheBypasser 5 ปีที่แล้ว +1

      Tro Ivas, Not clear enough - should it be read as "no need to use global-scope #using", or, instead, "no reason to ignore it and keep typing std:: everywhere instead"? If the second option it is, then - think of it - it is just four(4!) damn letters, if it feels too much the next logical step is moving on to non-commented code with single-character variable names ;)

    • @Este44fr
      @Este44fr 4 ปีที่แล้ว +3

      @@TheBypasser std::experimental::filesystem::path myPath;
      This is why you use "using namespace"

    • @TheBypasser
      @TheBypasser 4 ปีที่แล้ว +2

      ​@@Este44fr If used not on a single occasion, the secret spell:
      #define STD_EFS_PATH std::experimental::filesystem::path
      ;)

  • @renatobritto4096
    @renatobritto4096 5 ปีที่แล้ว +19

    This is amazing. All that computational geometry being put to practice.

  • @MuradBeybalaev
    @MuradBeybalaev 4 ปีที่แล้ว +158

    21:51 "If I put some *imaginary numbers* next to this..."
    A mathematician gets excited.
    21:56 Basic *integers* are drawn.
    The mathematician gets disappointed.

    • @youssef2366
      @youssef2366 3 ปีที่แล้ว +2

      Well in all fairness he didnt say lateral numbers

    • @violenceisfun991
      @violenceisfun991 3 ปีที่แล้ว +4

      "Pi is exactly 3!"
      Sorry. I couldn't help myself

    • @user-dh8oi2mk4f
      @user-dh8oi2mk4f 3 ปีที่แล้ว +5

      @@violenceisfun991 that’s the fundamental theorem of engineering

  • @tsraikage
    @tsraikage 2 ปีที่แล้ว +6

    i lost track of how many times i've watched this video series. 3d engines are my favorite field to practice with. even though i'm never able to fully recreate code on all platforms, its still so satisfying to listen to somebody's explanation who for sure knows subject so good even dummy like me can understand

  • @CSPlayerDamon
    @CSPlayerDamon 5 ปีที่แล้ว +7

    There is one thing I have to say.. AWESOME! Advanced material like this, presenting both the theory and implementation are quite hard to find. Thank you!

  • @OrangeDied
    @OrangeDied 2 ปีที่แล้ว +3

    The thing I like about this tutorial is how Javid explains the actual math behind it in an easy to understand way, so you actually learn about how it works instead of blindly copying code. Great tutorial!

  • @rightwingsafetysquad9872
    @rightwingsafetysquad9872 3 ปีที่แล้ว +22

    Episode 2: moving the camera.
    Episode 3: Duke Nukem.

  • @BrisbaneStomp
    @BrisbaneStomp 3 ปีที่แล้ว +1

    I've been thinking about this and other programmes you've made for a while but never thought anyone would be making these kind of programmes. So happy I stumbled across your channel, thanks a lot and keep up the good work mate

  • @khrissxander
    @khrissxander 5 ปีที่แล้ว +14

    This is incredible. You continue to amaze me.

  • @ChillBuilds
    @ChillBuilds 3 ปีที่แล้ว +13

    I'm not sure how much preparation you put in to your videos, but I would guess it's quite a bit because your explanations are well organized and clear of cluttered language. I appreciate that. Well done.

    • @javidx9
      @javidx9  3 ปีที่แล้ว +3

      Thanks Chill Builds!

    • @charlesdjones1
      @charlesdjones1 4 หลายเดือนก่อน

      I agree. Now go watch a tutorial by King Gath if you want to see the exact opposite, it's impossible to follow along with anything he teaches with all the sidebar stuff.

  • @rikittu
    @rikittu 3 ปีที่แล้ว +2

    I've always been fascinated how 3d graphics work but couldn't find a good video showing how to make it from scratch. I love that I found this video. Thanks for making it.

  • @BkSMedia
    @BkSMedia 2 ปีที่แล้ว +4

    As a student in their 3rd year of a degree program, I'm so thankful that my poor knowledge of Calculus, but somewhat decent understanding of Object Oriented Programming is paying off. Lots of really familiar concepts that have clicked and made me go "ahhh so that's what the lecturer was getting at!". It helps that I also used to 3D model game assets as well. Love that you've really gone to the absolute basics which is what I needed!

  • @TheGoldenriff
    @TheGoldenriff 4 ปีที่แล้ว +18

    This actually gold. I have a degree in computer science and am employed in the field, always wanted to know deeply about graphics. This puts all the math I have taken into a realistic perspective and im finding myself going OHHH, I can take integrals and use trig identities to play around with the actual physics. I want to generate running water and I now have a new respect for the heavy game programmers!! Such a sick course this is man. Appreciate your effort! Im also glad this was theory based and not coupled with a bunch of assumptions!

    • @wanderingpalace
      @wanderingpalace 2 ปีที่แล้ว +1

      this is cool i cant even get into university because i yeeted my entrance exam with a bit of depression
      now im trying to catch up with stuffs like linear algebra to make my own programs but it is particularly overwhelming after all the wasted years
      support you and looking forward to see your game

    • @nevanncopeland8093
      @nevanncopeland8093 ปีที่แล้ว +1

      @@wanderingpalace how'd it go. I hope you got into school and doing well.

  • @vinniciusrosa8284
    @vinniciusrosa8284 4 ปีที่แล้ว +14

    Things I have noticed here: 1) I have to study math 2) I have to watch this 500 times to understand the main idea. 3) I have to try it 20 times a day to get there. 4) Ok, it is hard, but this is amazing!

    • @DanielCoutoF
      @DanielCoutoF 3 ปีที่แล้ว

      if u cant understand watching it three times, forget about it, your head isnt for programming, specially if u want to work in the field, your productivity will suffer a lot if you take too much time to grasp new concepts.

    • @vinniciusrosa8284
      @vinniciusrosa8284 3 ปีที่แล้ว +5

      @@DanielCoutoF You are not a programmer. Maybe you feel like "I am the best of my class". I have worked on some big advanced systems that you cannot even imagine. I am talking about REALLY understand 3d. I know linear álgebra and a lot of complicated things. Please, get out. You didn't understand what I said.

    • @DanielCoutoF
      @DanielCoutoF 3 ปีที่แล้ว

      @@vinniciusrosa8284 stop replying to comments and go watch the same video for the 100th time.

    • @javidx9
      @javidx9  3 ปีที่แล้ว +10

      Hmmmm. The guy just said he didn't understand something. At least he can admit when he doesn't. That's an underestimated skill. So let's keep things a little calmer eh?

    • @nettoribeiro4267
      @nettoribeiro4267 2 ปีที่แล้ว +2

      @@DanielCoutoF "if you can't understand it watching it three times, forget about it, your head isnt for programming"
      That's not how it works. That would be the same as telling a kid who just started to play piano to go and learn an entire symphony orchestra by himself. He wouldn't be able to do it, because he needs to learn the fundamentals about music and try simpler songs first.
      This applies to programming too, in the case of 3D, maybe your background in math is weak and you need to work on it.
      That said, rewatching the video is a good thing ,every time you watch it, you will see things in a new and clear way. Once you grasp a topic, your mind will be free to worry about the other ones you were to busy to care before.

  • @harvymckiernan93
    @harvymckiernan93 8 ชั่วโมงที่ผ่านมา

    Gosh! This takes me back to the early 1980's. I must admit, the mathematical principles havent really changed. I use to do a lot of technical illustration work, and I remember reverse engineering my geometric grids and inputting the formulae into a ZX spectrum 48k. There was no reference model, so a lot of trial and error, and a few issues with the Tan function reaching infinity. I remember saying to everyone, this will catch on one day!! They Laughed! Unfortunatey, the refresh rate,was increadibly slow after barely contructing a cube. But it was absolutely fascinating to rotate the cube just by inputting a key$. I was in my element!

  • @andrewbhamilton
    @andrewbhamilton 3 ปีที่แล้ว +2

    I have studied 3d maths for games and written a simple software renderer before
    I can safely say, that is the best explanation of the protection matrix I have ever seen. Extremely useful.
    Thank you javid

  • @joshlovesfood
    @joshlovesfood 3 ปีที่แล้ว +4

    This video is actually incredible, I am impressed with your skills, and you are a very strong & serious computer scientist

  • @manuellehmann267
    @manuellehmann267 5 ปีที่แล้ว +236

    Oh, my god. He just opened pandoras box :-D
    3D graphics is an interesting but sooooo complicated topic. Looking forward for upcoming episodes. :-)

    • @javidx9
      @javidx9  5 ปีที่แล้ว +26

      Thanks donnerbrenn! It certainly does open up lots of opportunities for interesting videos

    • @starinsky2873
      @starinsky2873 5 ปีที่แล้ว +14

      Next time when you play games you will think about furious developer.

    • @jax2059
      @jax2059 5 ปีที่แล้ว

      Tro Ivas k

    • @jax2059
      @jax2059 5 ปีที่แล้ว

      Tro Ivas ok

    • @bonbonpony
      @bonbonpony 5 ปีที่แล้ว

      Well, it's good to know what's in the box if you're gonna use it.

  • @daviddawkins
    @daviddawkins 4 ปีที่แล้ว +5

    Such a good explanation of the projection matrix. Thank you.

  • @darklaker
    @darklaker ปีที่แล้ว +2

    This is something I made myself during a computer graphics subject some years ago on my computer science degree and It was hard to make it work without help or a simple explanation, I could handle solid objects drawing with polygon shading using the normals but I didn't go further to use textures or other advanced lightning like phong shading or raytracing.
    Even if there are much more advanced libraries and 3D engines It's important to understand where all that come from and make it work from scratch is much more satisfying. A tutorial like this would be a life saver for me those years, I haven't seen something like this before. Thanks for sharing!

  • @robertelder6155
    @robertelder6155 5 ปีที่แล้ว +8

    Really cool video. Thank you for taking the time to explain the concepts. The visual descriptions were nice and helped a lot. You also moved slowly and it was easier to keep up with your content and explanations. Keep up the good work!! Just started this series.

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Hi Robert, great to hear, thanks for your support!

  • @guacamolen
    @guacamolen 5 ปีที่แล้ว +12

    I was trying to find something on how to do this a couple of months ago. I'm glad I subscribed! Nice treat to see it.

    • @javidx9
      @javidx9  5 ปีที่แล้ว +4

      Good stuff! Thanks Michael

  • @dudubroder
    @dudubroder 4 ปีที่แล้ว +2

    Thank you so much! Omg I was so desperate in regards to learning C++ before watching this. You saved me! I know quite a lot of C# but never touched outside big game engines and C++. Now I watch your videos and everytime I have a doubt I stop it, open a tab and find the explanation before continuing. It is working great and also you are the programming bob ross

  • @TrebleWing
    @TrebleWing 5 ปีที่แล้ว +2

    Great presentation. All this kinda code is way above my head (at the moment) but you are entertaining enough to keep watching and absorbing. Thanks for making these.

    • @blacksage81
      @blacksage81 5 ปีที่แล้ว

      If you really want to learn to code, pick a language, write the most basic of basic programs. "Hello World" I'd recommend C++ since its old and there should be tons of resources and sample code available.

  • @spicytuna08
    @spicytuna08 5 ปีที่แล้ว +18

    final result is awesome.

  • @AaronBowley
    @AaronBowley 5 ปีที่แล้ว +14

    Seriously , this is the kind of content I yearn for . True fundamentals

    • @javidx9
      @javidx9  5 ปีที่แล้ว +2

      Hey thanks Aaron!

  • @mojoofc9528
    @mojoofc9528 5 ปีที่แล้ว +1

    I recently started learning the language, and this is my first language, this one video felt like 5 minutes, and I’ve learned soooo much. Going to the part two after the breakfast, I love you man

  • @vladisoc2866
    @vladisoc2866 4 ปีที่แล้ว

    This is pure gold. Your explanation about projection is incredible simple to understand! Thanks for sharing the knowledge!

  • @codecoderr7495
    @codecoderr7495 5 ปีที่แล้ว +4

    Now this is what I call old school math-rasterizer exercise. Brilliant because you have the talent to teach fluently. Same as I. Cheers fellow coder.

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Thanks Code Coderr!

  • @astrahcat1212
    @astrahcat1212 ปีที่แล้ว +3

    “We’re just gonna paint a lil struct over here……..that’s right, just a lil happy struct…” 😂😂😂😂

  • @chikokishi7030
    @chikokishi7030 4 ปีที่แล้ว +1

    I just found this series today. I instantly subscribed because ive been SO interested in this for years, and your videos seem very well made, thank you!

    • @user-ri2ms2mm7w
      @user-ri2ms2mm7w ปีที่แล้ว

      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 th-cam.com/play/PLPqH38Ki1fy3EB-8xmShVqpbQw99Do2B-.html
      th-cam.com/video/7d16CpWp-ok/w-d-xo.html

  • @fly7188
    @fly7188 ปีที่แล้ว

    thanks, your illustrations and explicit coding style really help illustrate the different components and concepts for this build. i learned much.

  • @uploadschedule
    @uploadschedule ปีที่แล้ว +3

    When he said that he will talk about the theory and the mathematical stuff at 1:06 i knew it was the right tutorial.

  • @josephmills1104
    @josephmills1104 5 ปีที่แล้ว +10

    This is just incredible, man. Wow, thanks for this!

    • @javidx9
      @javidx9  5 ปีที่แล้ว +3

      Thanks Joseph!

  • @Windeycastle
    @Windeycastle ปีที่แล้ว +1

    Thank you very much for this series! I'll happily code along and see where I end up

  • @SE45CX
    @SE45CX 5 ปีที่แล้ว

    What I like about your style is that you present this in a general DIY approach. Without the annoying snobbish attitude what you see so often.

  • @farazzaidi944
    @farazzaidi944 4 ปีที่แล้ว +243

    Start of Video - "I'm gonna make a Game Engine myself!"
    After 15 mins - "Well, why waste the efforts of those who've already done this mathematics..."

    • @BlakeKane
      @BlakeKane 4 ปีที่แล้ว +2

      It is a coding practice and a challenge.

    • @zephyr7
      @zephyr7 4 ปีที่แล้ว +13

      @@BlakeKane he was making a joke

    • @marsireteng3574
      @marsireteng3574 3 ปีที่แล้ว

      brah thats me right now

    • @madscientist7430
      @madscientist7430 3 ปีที่แล้ว +1

      @@username6338 #ItsACodingPracticeAndAChallengeGang

    • @aleisterlavey9716
      @aleisterlavey9716 3 ปีที่แล้ว +2

      "I wanna learn trough experience" perfect excuse for every fail you do.

  • @EximiusDux
    @EximiusDux 5 ปีที่แล้ว +18

    Ah. thank you for the projection matrix and its explanation. I once made something similar to this, but i never wrapped my head around the Matrix system. meaning: i was staring myself blind at the concept of it.

    • @javidx9
      @javidx9  5 ปีที่แล้ว +5

      No problem TriCore, glad it helped!

  • @canitbeapplied2500
    @canitbeapplied2500 2 ปีที่แล้ว

    Awesome tutorial ! The amount of depth you go into with everything makes it easy to translate to other languages.

  • @santichulito
    @santichulito 3 ปีที่แล้ว

    Man i love you, your channel is everything i need and more, just starting to code but this is the stuff i'm most interest on, you have a lot of really good videos with very nice explanation to everything and i can't thank you enough for you work, love from Argentina!

  • @JimmyJohanes
    @JimmyJohanes 3 ปีที่แล้ว +38

    can you imagine the source code complexity of program like 3ds max, blender ..

    • @javidx9
      @javidx9  3 ปีที่แล้ว +40

      Well i believe blender is open source, so no need to imagine it! Go check it out!

    • @javidx9
      @javidx9  3 ปีที่แล้ว +33

      github.com/blender/blender

    • @theslavegamer
      @theslavegamer 3 ปีที่แล้ว +3

      @Christian Weissmuller like a 3rd of the program is managing the interface, there's so many hotkeys for re-ordering and hiding UI elements. I love blender

  • @dynamagon
    @dynamagon ปีที่แล้ว +2

    Thanks for the video! You are a very great teacher, and especially great since this video is free. I'm following along in C with a 2D graphics pixel plotting engine I wrote from scratch!

  • @Genciak
    @Genciak 4 ปีที่แล้ว +2

    I really enjoy this video and will watch through the entire series. Thank you for great job!

  • @dz-
    @dz- ปีที่แล้ว +2

    Javidx9, your tutorials are fantastic! Thank you so much for them, and also for the magnificently documented olcPixelGameEngine.

  • @johnjackson9767
    @johnjackson9767 5 ปีที่แล้ว +34

    It'll be interesting to see how far you can get with a software renderer using your framework. It's also great that you're showing the math and concepts behind this - it's surprising to me ( and sad, frankly ) that even in industry there are devs who simply don't know this stuff.

    • @javidx9
      @javidx9  5 ปีที่แล้ว +11

      Hi John, I agree - it's all very well copying code parrot fashion to get a job done, but when it goes wrong knowing how to fix it is where the real talent lies. There will of course be some topics I can't directly cover using a command prompt alone, and as my colour and texture resolutions are a bit low, some techniques we take for granted on GPUs will simply not be applicable.

  • @joaquimspeck
    @joaquimspeck 5 ปีที่แล้ว +7

    This is awesome! Nicely presented!

    • @javidx9
      @javidx9  5 ปีที่แล้ว +1

      Thanks joaquimspeck!

  • @RoboMarchello
    @RoboMarchello 9 หลายเดือนก่อน +1

    This tutorial is so helpful with your math explanations, so easy to understand 3d with your videos compared to others. Thank you so much!

  • @duality4y
    @duality4y 3 ปีที่แล้ว +1

    I love these videos i never just copy the code I watch the video and try to undestand the concepts and then develop my own solutions which often happen to end up looking like the ones in the videos!

  • @saeed6296
    @saeed6296 3 ปีที่แล้ว +5

    I tried to do this projection in a lame way when I was in high school, this video brings back those memories 😭 you're awesome

  • @fckyo333ujhjjkrrrr
    @fckyo333ujhjjkrrrr 5 ปีที่แล้ว +4

    Thank you Javid, very cool

  • @VS-rv5xh
    @VS-rv5xh 4 ปีที่แล้ว +2

    thanks to you i finished my bachelor in IT since I really found my love for programming again

  • @reubenbridges
    @reubenbridges ปีที่แล้ว +1

    Feels like I just watched a classic PBS show on programming, late 80s early 90s. Excellent video.

  • @gettanned-foureyes2417
    @gettanned-foureyes2417 5 ปีที่แล้ว +10

    This is What I acutually want to know !
    Hope The Next Video will be Uploaded Tommorow .

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      lol, sadly it wont be tomorrow - but I hope to show quite a complete system by the end of the series.

    • @gettanned-foureyes2417
      @gettanned-foureyes2417 5 ปีที่แล้ว +1

      Though it won't be tommorw ,
      it can be uploaded 2 hours later ( exactly not tommorw but today ) .
      ... Sorry , What I wanna say is I like your videos as much as I think so .
      If I can push Like 3.14 times or 2.718 times ...
      But TH-cam allow me to push it only once .

  • @ankursharma4827
    @ankursharma4827 4 ปีที่แล้ว +8

    Did I ever tell you this, "You are just awesome, man!" :-)

  • @otacilioribeiro8944
    @otacilioribeiro8944 4 ปีที่แล้ว +2

    this is awesome, you are a excellent at what you do and i love your way of explaining stuff;
    I spent some good time pondering about this video and i am amused. Thank you!
    By the way, i noticed that the comments of top and bottom triangles are switched, the bottom is actually the one initialized and drawn first

  • @arsnakehert
    @arsnakehert ปีที่แล้ว

    This is probably the best explanation of projection matrices I’ve seen on the internet

  • @aradarbel4579
    @aradarbel4579 5 ปีที่แล้ว +4

    just found your channel, and saw this video! this is exactly what I was looking for! You have a new sub ;D

    • @javidx9
      @javidx9  5 ปีที่แล้ว +1

      Thanks buddy!

  • @pendergastj
    @pendergastj 5 ปีที่แล้ว +7

    Just what ive been waiting to see! Awesome!

    • @javidx9
      @javidx9  5 ปีที่แล้ว +2

      Hi jamie i hope it lives up to expectation!

  • @Poeterish
    @Poeterish 2 ปีที่แล้ว

    Pleeeeease never stop making videos on TH-cam !
    Thank you so much for your effort !

  • @Pedozzi
    @Pedozzi 4 ปีที่แล้ว

    you are such a smart person. I studied industrial design, and i really appreciated this serie, even if i don't know how to code it is a great way to understand at least what 3d graphic (3D on 2D) engines do on a macro level. Thanks

  • @lucs0091
    @lucs0091 5 ปีที่แล้ว +14

    I learned by heart all the algebra formulas to pass an exam, but never understood them... until now.

    • @javidx9
      @javidx9  5 ปีที่แล้ว +9

      Good Stuff Lucas, i learn maths much quicker if I have a practical use for it.

  • @spjewkes
    @spjewkes 5 ปีที่แล้ว +7

    Nicely done, David. I’m looking forward to the last episode of this series where you demonstrate a spinning, textured Vimto can :)

    • @javidx9
      @javidx9  5 ปีที่แล้ว +6

      Lol Steve, you know what? Challenge accepted!

  • @christianmoss9196
    @christianmoss9196 3 ปีที่แล้ว

    Just came across this and your channel, amazing stuff, as a modern day game dev even just watching the videos helps me understand what my abstracted game engine is doing under the hood

  • @erickalvarez6899
    @erickalvarez6899 4 ปีที่แล้ว +2

    You're awesome!! Thanks for these series. I'm learning a lot watching them!!

  • @peepwebdev575
    @peepwebdev575 3 ปีที่แล้ว +5

    I have just starting watching OLC videos. i have been amateur coding for about 3 years with python and some JS. This is fascinating. I cannot grasp the mathematical concepts but i kind of get whats happening with the C++. I'm going to try and dissect this video series and hopefully come out the other side with a basic understanding.

    • @javidx9
      @javidx9  3 ปีที่แล้ว +2

      Glad it was helpful!

    • @user-ri2ms2mm7w
      @user-ri2ms2mm7w ปีที่แล้ว

      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 th-cam.com/play/PLPqH38Ki1fy3EB-8xmShVqpbQw99Do2B-.html
      th-cam.com/video/7d16CpWp-ok/w-d-xo.html

  • @ILGiullareDiCorte
    @ILGiullareDiCorte 5 ปีที่แล้ว +5

    Very thanks! I am a computer science student and i love all your projects but this, is awesome! Thanks for the time that you spend for share your knowledge!

    • @javidx9
      @javidx9  5 ปีที่แล้ว +2

      No problem! Thanks for your kind words and support!

  • @adibattie9619
    @adibattie9619 9 หลายเดือนก่อน

    5 years later and this video is still top notch. I followed along a few years ago and got it working in C++. I revisited this today because I wanted to try and get it working using my own programming language, which already has C++/SDL bindings. I wanted to get some 3D action happening but with OpenGL I would need to spend at least a week writing GL bindings, but with this approach I can get some basic 3D stuff happening using only the SDL API I've already written. Amazing stuff, thank you Javid!

  • @mr_noodler
    @mr_noodler 11 หลายเดือนก่อน +1

    This guy is so awesome because the more I practice programming, every time I watch this I understand more and realize how much he really knows what he’s talking about. Javidx9 is well educated and experienced

    • @Agent56000
      @Agent56000 27 วันที่ผ่านมา

      Any advice for a complete beginner

  • @mattstirling6317
    @mattstirling6317 5 ปีที่แล้ว +15

    "Have a think about subscribing"
    I thunk, and I subbed.

    • @romanthegambler6966
      @romanthegambler6966 4 ปีที่แล้ว +3

      *Thunk*
      \*A sound of bumping your head into subscription button\*

    • @furkanunsal5814
      @furkanunsal5814 3 ปีที่แล้ว

      You Thunk?

    • @ithaca2076
      @ithaca2076 3 ปีที่แล้ว

      @@furkanunsal5814 he thunk

  • @masterride3604
    @masterride3604 5 ปีที่แล้ว +16

    4:31 Here it is, a croissant XD

  • @ffabiang
    @ffabiang ปีที่แล้ว

    Thank you so much for this video, I have been learning more about how 3D engines work and this was just what I needed! Greetings from Peru!

  • @Ryan-xq3kl
    @Ryan-xq3kl 3 ปีที่แล้ว +1

    This is the kinda info we can use to make 3d game design more applicable to more varieties of programmers

  • @Levigumba
    @Levigumba 4 ปีที่แล้ว +10

    "Now we won't get quite that far in this video..."
    *checks vid length*
    Oh boy do I have some catching up to do

  • @ChenHuang
    @ChenHuang 5 ปีที่แล้ว +3

    Wish this was available when I was learning about software rendering myself, very good material

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Thanks Chen!

  • @thyandyr7369
    @thyandyr7369 5 ปีที่แล้ว +1

    Oh wow just what I always wanted to see! Exiting hope it's more than just one episode!

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Lucky you, there's 3 more and some more this year XD

  • @AlexGarcia-cr5st
    @AlexGarcia-cr5st ปีที่แล้ว +1

    Love your tutorials man. You are a true computer wizard.

  • @gmodrules123456789
    @gmodrules123456789 4 ปีที่แล้ว +5

    Minor but important detail. The matrix multiplication here is in row-major, but all of the matrices on Wikipedia are in column-major, so you will need to convert them before implementing them.

    • @mmiisshhaa
      @mmiisshhaa 4 หลายเดือนก่อน

      right??? I'm currently ending my first linear algebra course in uni, and I was quite stuck on what he was doing there... Do you know why he did this? isn't row more common?

  • @alexanderhugestrand
    @alexanderhugestrand 5 ปีที่แล้ว +9

    I liked this video without even watching, since this kind of programming is where I come from. An idea I've implemented myself: Skip the whole concept of a "near" plane for clipping the polygons and clip them against the view frustum instead. That way you can get infinitely close to a wall without seeing anything clipping. In the very unlikely case where the clipped polygon gets a point exactly at the origin, you can skip that polygon altogether to avoid division by zero - the player wouldn't see the polygon anyway, since the camera is exactly in its plane.
    If done right, so that you can trust the clipping algorithm, you'll be able to get rid of a bunch of if-statements in the inner rasterization loops (that's an optimization) where you normally would clip the projected triangle against the screen edges.
    Yet another idea to do all this but still render things on the GPU: Write the rasterization in OpenCL or CUDA.

    • @javidx9
      @javidx9  5 ปีที่แล้ว +5

      Hi and thanks Alexander. I think there are several ways to interpret near plane clipping - I do move on to frustum clipping later in the series. I spent some time once rendering triangles with CUDA. The rendering bit is easy, but the scene partitioning bits to make sure the right warps/groups are accessing the right structural data is a real pain.

  • @viperforty8450
    @viperforty8450 ปีที่แล้ว +1

    Thanks for the content my guy, watching your videos and getting ready to make a replica of an online childhood game in another game in lua, hope i will find strength to fully make it

  • @Destroyer19941995
    @Destroyer19941995 3 ปีที่แล้ว

    LOVE the projection matrix explanation!!

  • @kennyotsu4357
    @kennyotsu4357 5 ปีที่แล้ว +3

    I love ur videos, even when i totally cant understand what the heck is going on here, but i love ur videos :3

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      lol, thanks Deku, if you get stuck shout out on the discord server, people willing to help on there!

  • @3DSage
    @3DSage 5 ปีที่แล้ว +8

    Ahh you beat me to it! Haha great video as always.

    • @Pridetoons
      @Pridetoons 5 ปีที่แล้ว +2

      3DSage I wish you'd post some Gameboy Advance tutorials on your channel.

    • @Pridetoons
      @Pridetoons 5 ปีที่แล้ว +2

      Also from watching your channel I heard you want to make a Game Console. I have two books to recommend to you.
      1) The Black Book of Game Console Design from Andre LaMothe
      2) The ZX Spectrum ULA
      Also check out the UZEbox.

    • @javidx9
      @javidx9  5 ปีที่แล้ว +3

      Lol oh dear, thanks 3DSage, clues in the name though right? XD it would be interesting to see this done from a more embedded systems perspective.

    • @3DSage
      @3DSage 5 ปีที่แล้ว +1

      Yes I will do that sometime!

    • @3DSage
      @3DSage 5 ปีที่แล้ว +1

      Yes It would be a dream of mine to make my own game console. It would be incredibly simple but even that would be amazing to me. Thank you for the books!

  • @TheDonaldskates
    @TheDonaldskates 2 ปีที่แล้ว +2

    you explain this very well and you make it seem easy when in reality this takes a lot of patience

    • @javidx9
      @javidx9  2 ปีที่แล้ว +3

      That's the curse of TH-cam videos. Never assume anything I do on screen takes 30 minutes. Editing makes it look that way, but in reality it's much longer. The objective of my videos is to expose people to the things they may need to know about to achieve a specific goal.

  • @nockieboy
    @nockieboy 3 ปีที่แล้ว +1

    I'm looking to make a hardware 3D accelerator for my home-made 8-bit computer using an FPGA, and this channel is the first place I came to for details on the maths - and you did not disappoint!!

    • @javidx9
      @javidx9  3 ปีที่แล้ว +1

      Sounds like a great project!

    • @nockieboy
      @nockieboy 3 ปีที่แล้ว

      It's certainly testing my knowledge of programming and electronics! Keep up the great work - I'm learning loads! 👍