Hey, its long I know, but its difficult to demonstrate cameras without clipping, and its not very interesting to demonstrate clipping without cameras :D Anyway, as with all my videos - best enjoyed in your own time, and at your own pace.
@Jacbo16 жыл бұрын
My camera keeps rotating up and down when I'm not touching anything and it changes when I go above or below the object. Any help? It's been doing it since I implemented moving and turning the camera (I only have yaw turning though)
@compositeembryo71865 жыл бұрын
just wondering about olcConsoleGameEngine... is it available to the general public to look at or do we write our own?
4 жыл бұрын
@@compositeembryo7186 it is on github and is open sourced. (oneLoneCoder).
@chri-k3 жыл бұрын
I found this channel after I decided to make a 3d software renderer, and got stuck at some weird skewing when rotating the camera. by coincidence I was using olcPGE. and my 'camera problems' were caused by incorrectly scaling the coordinates before drawing (rendering some offscreen stuff) :/ .
@javidx9extra3 жыл бұрын
Sounds like your matrix calculations are not quite right.
@smellthel3 жыл бұрын
“If your goal is to learn about wheels, then there’s nothing wrong with reinventing the wheel” I think Jack’s a genius
@D0UGlE4 жыл бұрын
This is exactly the level of complexity and abstraction I have been looking for in beginning computer graphics, but I could never find in the places I've looked. This series has given me a lot more confidence in approaching the maths and API's of lower level graphics programming. Thanks javidx9!
@outsider1st6 жыл бұрын
Wow, wish I had them math skills.. This is honestly the best KZbin channel when it comes to designing games / engines from scratch. I like that you're not trying to overcomplicate things by adding complex language's features, I think that's good approach of teaching. Well done!
@javidx96 жыл бұрын
Thanks Niko, I get a mixed response because my videos do not demonstrate "best practice" whatever that is, but I try to make the videos about the ideas rather than the language
@MatheusSilva-bi2yc4 жыл бұрын
@@javidx9 I'm followng along but in linux and rust and I usually don't like videos and gamedev in general because they don't explain the ideas but you do, I'm an experienced backend programmer and the field of graphics is fascinating to me thanks. And so I believe that best practices are to be used by oneself when they get to do this "for real"
@CottidaeSEA4 жыл бұрын
@@MatheusSilva-bi2yc Best practice to me seems more like "whatever makes most sense to use" because in every scenario I've encountered, performance is second. You don't rewrite code that works unless you need to improve performance. Functionality always comes first.
@MatheusSilva-bi2yc4 жыл бұрын
@@CottidaeSEA and readability it's very rare to see a moment where perf is more important than readability.
@CottidaeSEA4 жыл бұрын
@@MatheusSilva-bi2yc Yeah, naming in particular is something I get annoyed by. Some dude arbitrarily having single letter variables in the code, good shit. Especially fun when working with JavaScript or some other non-strict language, but even in a language like Rust it's just awful. Also, documenting absolutely everything isn't necessary, and sometimes a method/function name does enough to tell the reader what it does. However, sometimes you have situations where there's absolutely no documentation. That's not a fun time.
@3echo04 жыл бұрын
For those who enjoy following along with the video instead of loading up the final source code, and things display back to front when you first load up "axis.obj", there was a bit of code skipped at the end of the first section where x/y of triProjected are inverted ( *= -1.0f) before offsetting by {1, 1, 0}.
@miloz19504 жыл бұрын
Note: line 607 in file
@_Vesper3 жыл бұрын
Thanks a bunch, that had me stumped for a little while so I decided to check the comments
@RaffaelloBertini3 жыл бұрын
it is caused by an error in the projection matrix (the projection matrix is not quite right for the final reprensentaton). There is no need to "hack" with a *=-1.0f if the projection matrix is correct.
@nates97782 жыл бұрын
I had this problem while making my own axis.obj in Blender. While testing the projection matrix with a bunch of debug meshes I created in the code, everything seemed to work fine, but when exporting from Blender the Z-Axis was flipped. It seems to be the case that in our 3d-application, we are using a left-handed coordinate system meaning if we use our left hand and we curl our fingers from the X-Axis to the Y-Axis, our thumb (Z-Axis) is facing away from us (the camera). And in Blender it's reversed, if we curl our right hand from X to Y, Z is facing towards us. And on top of that there's the whole thing were blender switches Y and Z and you have to export as "Y-Up" and that makes things even more confusing.
@wheany2 жыл бұрын
@@RaffaelloBertini And the error in the projection matrix is that the element on row 2, column 3 (0-based index, as in the code) should be a -1 instead of 1. After that you also need to fix the depth sorting function to return the triangles in the opposite order.
@jimjohn26526 жыл бұрын
That awkward feeling that a random youtuber can explain Analitical Geometry much more intuitively than your average college professors.
@javidx96 жыл бұрын
Thanks Jim, but to be fair there is a lot of stuff that I don't cover too - but I'll take it! :D
@hamyncheese5 жыл бұрын
also, he is not a "random" youtuber. He is a well educated, highly experienced, articulate professional in the related field. Your average college professor prefers velcro over shoelaces and can't cook a pancake.
@o0julek0o5 жыл бұрын
Quite frankly, most university lectures (UK here) are garbage who are winging it just like most of us. Pointless.
@jsonkody5 жыл бұрын
Cause this 'random guy' has provably better idea what he is talking about than just some average professor simce hes spend last 30 years by programmimg this stuff? Maybe because that ....
@jsonkody5 жыл бұрын
... sry. I am writing on mobile 🤔🤨😶
@lonkwuzhere44333 жыл бұрын
Thank you so much for this video series. a lot of the math that goes into 3d projection is really intimidating and hard to understand but your method of introducing a method as a black box then elaborating on that method further down the line really helps me understand the information being presented. Considering that I'm a high school student with below-average math grades and even I can understand and comprehend what's going on in these videos is just incredible. One other thing, I'm not just stealing the code you've graciously put up on Github, I'm writing it from scratch in python 3.7 with the PyGame library for plotting and some Vector3 calculations as well. The fact my code works at all is just a testament to how well-structured your videos are. Keep doing what you do man you're the best!
@javidx93 жыл бұрын
Hey I appreciate the kind words Lonk! Keep practicing and it all clicks soon enough!
@blahbeastie6 жыл бұрын
I really appreciate that you took the time at the top of this video to walk through the decision making process behind your refactor. I think people at every level of software development get frozen up and often completely shut down by these kinds of design dilemmas; I feel that you taking the time to talk about your own choices is a nice way to let people know that they are not alone in their indecision.
@javidx96 жыл бұрын
Hi Tyler, thanks for your support. It's easy for people to become overwhelmed by code, but they must never forget that its completely ok, and with time they will come to understand it.
@thefrenchdev9653 жыл бұрын
Looking at this 3 years later and this is so instructive! I never had any class on the subject and I think the explanations are so clear. I won't make my own engine but I find it so interesting to see how it works.
@htweiss2563 жыл бұрын
This is a great little project! I got a great deal of enjoyment out of implementing your 3D Graphics Engine in/for a SFML Render Window. I slowly work my way through the videos and watched a few others. It allowed me learn a great amount and revisit mathematics I haven't used in years. My real surprise and delight was when I realized/understood your window or frame was the actual Window's "console window" and the implications. Dude, That's Novel! Good Show!
@javidx93 жыл бұрын
Thank you! 😊
@dailyshadow4 жыл бұрын
I’m going to have to watch this one a few times to understand. I never got into vectors or matrices so this is all new to me.
@dailyshadow4 жыл бұрын
Also, it’s hard to wrap your head around how many calculations computers are doing at a time when playing a game.
@nixcc16284 жыл бұрын
@@dailyshadow I know this is kinda late but I recommend 3blue1brown's series on linear-algebra he explains intuitively how matrices and vectors work
@jaimefranco38752 жыл бұрын
@@nixcc1628 thx I nees to study my mathematics
@haikamu71782 жыл бұрын
You can checkout khan academy for intuitive explanation of those math
@whoshotdk4 жыл бұрын
To those following along; In the Triangle_ClipAgainstPlane->dist method, there's an unused normalized vec3d n. Don't attempt to fix the line below with that variable; else you'll be normalizing the value twice :P Excellent tutorial Javid. I heard a rumour there's more 3D to come; I'd love to see a Javidsplanation of parent-child transformations for an object/scene graph!
@art_out_of_despair9 ай бұрын
I have NO WORDS. This is some sort of Art. For my humanitarian mind - almost a Drama. I'd wish you were my Math teacher at school years-years ago, I would understand what a greatest goal I have to suffer for! Thank you for the pleasure of learning from you!
@javidx99 ай бұрын
That's very kind of you, thanks!
@nailbomb4205 жыл бұрын
That intro giving me the frontier elite 2 vibes 😍
@kamran_aghlami6 жыл бұрын
55:20, thanks to this now I can't play games without hitting 100% brain usage trying to visualize every thing thats happening under the hood, I'm almost 2 months into learning computer graphics and I am just enforcing my belief in "making games is way more fun than actually playing them.", every day. You've done a great job of explaining every bits of math that's going on. As a 'NOT a math genius' I really appreciate your efforts trying to visualize concepts for us visual learners. I don't have much to say as I am still recovering from joy of watching this, please never stop making these videos.
@javidx96 жыл бұрын
Hi Kamran, Working out how games get made can take the shine off a game itself, but I agree with you its quite addictive! I try to present concepts and ideas to programmers, who may not be specialised in certain fields, hopefully to demonstrate that this stuff is not too hard once you know the basics :D
@mogusugom8 ай бұрын
i have stayed up at night just to watch this video since it gives so much juicy information that I haven’t heard from anywhere else and explained well too.
@Hyperdelica-Xander6 жыл бұрын
I'm just incredibly in awe of both your progression and work.
@javidx96 жыл бұрын
Hi Khriss, to avoid replying to all your posts - its great seeing you watching through the back catalogue! So Thank you very much for all your kind words!
@jamesking2439 Жыл бұрын
It's pretty cool getting to see everything that the hardware and graphics api normally does for you.
@chessprogramming5912 жыл бұрын
If anyone was wondering why cube mesh no longer works with these new Part3 vs Part2 updates - make sure to initialise 'w' in the cube mesh definition. It took me a few hours to realize like why cube wasn't appearing on screen. But I'm following this tutorial in JavaScript, not sure how likely it would behave in C++, IMO it should either not compile or result in undefined behavior. P.S. Javid, thank you for amazing tutorial, I'm close to making my own mine craft like program to build binary logic circuits in 3D, thank you so much for your time and effort, code is very didactic so even a noob like me can understand it)
@joedempseysr.33765 жыл бұрын
I thoroughly enjoyed your video to the point where I'm going to go back and watch Parts 1 and 2 before I continue to Part 4. The amazing thing to me is that it was all done using console characters. I'd like to see it rendered with your graphical framework. Oh, and just one more thing: Your intro made me think of "2001: A Space Odyssey" straight away! I loved it!
@javidx95 жыл бұрын
Hi Joe, thanks! I do show a few clips of the software renderer at the end of Part #4, but also in introducing olcPixelGameEngine. However, my recent Top Down City Based Car Crime Game video uses the engine extensively too.
@robertboran62346 жыл бұрын
A lot of great Math. The beauty is when you mix it with code. Very nice as usual.
@javidx96 жыл бұрын
Thanks Robert - a bit of a maths overload this series - normal service to be resumed shortly :D
@lucs00916 жыл бұрын
This is still the console application right?
@javidx96 жыл бұрын
lol yes :D
@doom6946 жыл бұрын
javidx9 Very nice
@joedempseysr.33765 жыл бұрын
Even when you know exactly how it works, it still looks like magic! 🤓
@CMYTUB5 жыл бұрын
@@joedempseysr.3376 TRUE!!!! And very fun!!!!
@davidpike7666 жыл бұрын
every time you say "intuitively", I add two weeks. love the videos, though- thanks Javid
@3DSage6 жыл бұрын
Great video as always, and I like the intro with the music! Perfect. I can't wait to see what you do next.
@javidx96 жыл бұрын
Thanks 3D Sage - based off the old elite intros :D
@atarixle4 жыл бұрын
Big thumb up, the result of this step-by-step-explained knowledge is jaw-dropping!
@DavidBauer382 жыл бұрын
Best... Intro... Ever.... Hope you and the family are doing well, sir!
@celestialamber1746 жыл бұрын
Thanks for making this tutorial series! Following along using Unity is really helping me understand the underlying aspects of 3d rendering.
@javidx96 жыл бұрын
Hi CelestialAmber, saw you on the discord, good stuff!
@NeilRoy6 жыл бұрын
Very impressive! I done a sort of a hacked frustum culling on a project of my own. Not nearly as good of a job as you did. But once I culled out the objects that were not in view, the speed increase was tremendous, and I haven't even implemented backface culling which is really simple as you already showed. I figured if I could get some sort of occlusion culling the speed will ramp up quite a bit more. Like you, I am fascinated at just how much of this sort of stuff modern games do in order to make a scene look extremely complex, yet they are cutting out SO MUCH you cannot see, it's amazing. The faster you make it, the more detail you can add in for what you do see. In my own test code, I didn't do it as well as you, I have what is a cube world (I started this long before minecraft, so no influence there, though now I see I could have made a million on this, LOL) and I basically just check along a grid, discarding grid locations that are not in view. I actually use a 2D level editor to plop down buildings which are various height cubes in a city setting, or a road which is a flat section on the grid. I also found some really nice code I used in a lunar landscape 3D program I made which checks your location within a polygon you are directly over top of and then sets your height based on that for some terrain following. It was fairly simple math to determine the position within the polygon then check the height at that location using the normal of the plane etc. Kewl stuff anyhow.
@MrKriegus5 жыл бұрын
6:04 I don`t think we need to create that Identity matrix, since we completly change the matWorld matrix on the next line, therefore we don`t need to make the MakeIdentity function at all unless for the purpose of the next video and I have not watched that one yet 34:25 Isn`t the xNX + xNy also a dot product between the function and the normal making the equation from 45:10 just simply: Vector_DotProduct(plane_n, p) - Vector_DotProduct(plane_n, plane_p)?
@Qwantopides9 ай бұрын
You sir have made an outstanding job making these videos!
@dehrk90244 жыл бұрын
The space odyssey intro was awesome! xD
@mdimransarkar11032 жыл бұрын
This is absolutely stunning.....you can make everything with triangles!
@LuigiTrabacchin4 жыл бұрын
I had to work with a lot of 3D software and i certainly treated lot of those matrix transformations as black boxes too, i'm finally getting used to them and understand em! i'm looking forward in doing my own 3D engine (in another language i like more xD) so i can finally totally grasp it. Just to trash it and get back to open GL, maybe i'll keep it to brag with friends! BTW Thanks! amazing series !
@arseniimasiuk77055 жыл бұрын
this is the best explaining of 3d graphics what i ever seen. Thank you!
@MaikKellerhals3 жыл бұрын
i tried several tutorials on 3d engines, this is the only one i really understand and can follow easily step by step. Thank you very much! I'm implementing it on a Teensy 3.6 controller board (ARM Cortex-M4) with a 64x64 LED matrix using the SmartMatrix library for drawing. It works perfectly and doesn't use too many resources (yet). Only ram is a problem (256KB). Ship loads fine from SD card, teapot ist far too big, ram overflows, but other simple meshes (up to about 300 tris) work absolutely fine! Might need to upgrade to a Teensy 4.1 ;) edited the import code to use sdFat library and handle quads (if 4 values, make another triangle with values 1, 3, 4).
@javidx93 жыл бұрын
Hey thats awesome Maik, is 64x64 high enough definition to sensibly make out what the objects look like?
@MaikKellerhals3 жыл бұрын
@@javidx9 It's just enough, especially in wireframe with antialiased line drawing. The low resolution models help too ;) See Video here: kzbin.info/www/bejne/rnbcnJt8pdWNotE I've also implemented XBox controller support over Bluetooth to control rotation and move around in the scene. Thanks to you I'm now starting to implement my own 3d engine for Browsers in JavaScript/WebGL
@TheBypasser5 жыл бұрын
Lovely but slow :P You could collapse your whole stack of transforms into a single model-to-projection matrix before rendering the frame (so that a vertex would immediately become transformed into the view frustum, by the way the off-center offsets, the output resolution and such can already be included into that matrix as well so you are only left to divide the vector components by the last one in order to get the 2D frame you need) which will save you the need to multiply every vertex later on with every transform matrix one by one. Also a good step is to add a vertex buffer which you can simply process before working on the triangles themselves, so that every vertex coordinate set would be multiplied just once no matter how many triangles reuse it. As this ends up in clipping, it is even more fun as all the extra vertices you get from clipping do require no matrix operations at all as they are already in the view frustum space. The normals would require a separate path in this however, as they don't like to be screen-space ;)
@illiasolohub32253 жыл бұрын
the enetrance is just a masterpiece
@GodofWar15156 жыл бұрын
Wow this is really great!! I really learned a lot from this. I now understand how 3d cameras work. The math is also really great. Great job.
@javidx96 жыл бұрын
Cheers Lucas, its only a primer really, there are lots of additional techniques I've not covered, but I'm pleased you got something from it.
@tezza486 жыл бұрын
You got me hooked on the elite intro! I'll be watching from the start :D
@javidx96 жыл бұрын
Ahh a fellow elite fan, excellent! Hello Commander Will!
@tezza486 жыл бұрын
o7 CMDR. I first saw it in 1st year on my degree in what's basically an "ancient games" module that ended up on early videogames, from then i was amazed and had to play it. OOlite confuse the hell out of me so i settled for ED, which is hardly a downgrade it seems!
@christianarroyo32656 жыл бұрын
I like watching your videos (even though half the time I don't know what you're talking about lol) but I have a few questions. 1. How did you get into coding? Was it always a passion you had? Did you go to college for it? And if so, what majors/minors did you take up to help with your journey to programming? Do you only program in C++? And what have you programmed? (I guess a basic synopsis of your programming career journey) 2. What actions would you recommend new/aspiring coders who want to program (whether its C++ or Java or whatever) to take? I myself was exposed to coding in my second year of college in my fourth semester (currently about to head into my third year of college/fifth semester) when I had to take a required course on C++. Even though I enjoyed the class, I felt it was too easy not necessarily because I was good at it (that can be debatable) but because my professor only taught the most basic things in C++. This left me wanting more, as I want to learn more C++ and any other programming/coding including Java, JavaScript, Python, PhP, etc. So recently I found a website that was devoted to teaching C++ and it's lessons were opened to everyone. I want to argue that I learned more from the website from my actual class (but I digress). Even though I have learned a considerable amount of C++ from this website (and will learn more) do you have any tips for learning programming easier? Any other websites for any other programming/scripting languages? Is there some topics in mathematics I should always know in case I decide to program (since I see that a lot of the more advanced mathematics are essential to a lot of your coding)? Also, as a beginner, what should I aspire to program (I only know that I want to program, but I don't know what to program)? 3. Even though you make videos on how you code using more advanced techniques in C++, have you ever thought on making videos teaching the different aspects of C++ from the most basic stuff to the more advance stuff for new/aspiring programmers? Either way, I still watching your videos. Even if I'm not sure of all the stuff you do, watching your videos aspires me to learn more and more C++ so that one day I might be able to understand all aspects of your videos and, hopefully, be as skillful as you. Keep up the great work! :)
@javidx96 жыл бұрын
Hi Christian, 1) I started coding when I was 9 on a BBC Micro Model B+, I seemed to have natural understanding of it so I chose not to study it formally, but took qualifications in my early teens for Pascal and C++. In college I studied maths and physics, and at uni I studied Systems Engineering (electronics and embedded computing). After uni, I switched to neuroscience for a PhD. I program in C/C++, Pascal, Basics, x86, Thumb2, Java, VHDL/Verilog and Lua. I have dabbled and done things in numerous other languages too. I don't think the language itself actually matters, its more the awareness of how you are harnessing the computer to solve a problem - this takes time and practice to learn, whereas the specific syntax of a language can be picked up in days. 2) Please see this video kzbin.info/www/bejne/rIe1dH1rZ8xoo5Y which I feel answers most of your question. Also, getting quick sensible answers to questions when you have them is important, so (shameless plug alert) join our discord server! I think people assume maths is a requirement for programming, but it isnt. 90% of the time you need simple arithmetic. Applications such as 3D engines do require that you have an awareness of basic vector geometry, but rarely do you need advanced mathmatics, unless of course that is the focus of what you are trying to achieve. For games in particular, a basic grasp of kinematics and laws of motion is very useful too. You should aim to program things you enjoy, but are mostly within your ability. I feel learning programming doesnt come from taking on ambitious projects, but from debugging normal projects - you'll learn far more from making mistakes than drowning in complexity. 3) I have. I don't consider any video on this channel to be advanced C++, and in most cases I actively simplify the code to make it accessible and educational for people like yourself, lol, this angers the people who do like advanced C++ code :D I can't win... anyway, I am considering doing some "Back To Basics" videos in the future. Thanks, I will!
@christianarroyo32656 жыл бұрын
Thank you so much for your response, it really means a lot to me. I will definitely be sure to take your advice and watch the video you provided for me! :)
@joedempseysr.33765 жыл бұрын
@@javidx9 In my Comp. Sci. classes I got 3 kinds of students: 1) The "slow", who will never understand the material, so I can't teach them. 2) The very bright who probably understand the material better than I do so I don't have to teach them. And 3) Everyone else who lie within the first standard deviation, IQ wise,. Now my challenge is to try to reach as many of them as I can. My point is that if you teach to the middle most of the time you can't go too far wrong. I think you strike just the right balance.
@3DSage6 жыл бұрын
A black and white checkerboard texture would be fun to see next!
@javidx96 жыл бұрын
Oh I see, that nice easy one that will look really great, with no requirements for complex spatial filtering algorithms? I see what you are up to :D
@AinurEru5 жыл бұрын
javidx9 correct me if I'm erong, but regarding computation of the "new up" vector (around 24:13 ) there's aactually a way to defive it without any computation at all - just by coordinate-substitution and negating some of them: Say we got the forwards vector, and normalized it, as you've described (call it "F"), then "assuming" a "described" up vector of the positive Y-axis, and a lef-handed coordinate system, the "new up vector" ( call it "U") would simlply have the coordinates: Uy = Fz Ux = -Fx Uz = -Fy You can see it if you initially draw a unit circly in 2D, with Z-axis pointing right, and Y-axis pointing up, then draw some unit-length F vector from the origin, then a perpendiculat to it at the other side of the Z-axis. You'll see that Fy maps to -Uz and Fz just maps to Uy. Then, imagin rotating that entire 2D plane around the Y axis towards you (outside the paper, clockwise if looking at this from Y downward), then assuming a left-hand coordinate system (X-axis pointint out of the papaer), you'll see that any such rotation taking F some amount outside the paper, takes U exacly that amount inside the paper, so Fx maps to -Ux. I thow that the's an assumption there about which direction is up, and what handendness is, but: Regarding handedness, you're entire codebase has to assume one way or the other anyways (as this here does for the cross product when computing the "right" vector), and regarding the "Y up" assumption, you could just have your function "switch" on which coordinate of the provided up-vector is set to 1, and just do a different substitutions accordingly (flipping signs in other directions, etc.). Am I making sense or am I missing seomthing?
@ppotter104 жыл бұрын
Truly love the more in-depth explanation of your videos! Can understand that it might be a little hard to understand if you don't have a math/engineer background, but there are other videos for that :)
@bscubed6 жыл бұрын
Nice 2001 reference, and an amazingly insightful video. Loving this series so far!
@javidx96 жыл бұрын
lol, thanks Brendan! Its interesting seeing generational differences interpreting the intro. Some say 2001, others say Elite :D
@billowen32853 жыл бұрын
@@javidx9 whoops I thought it was star wars haha
@gregattraf2 жыл бұрын
Wow! Thank you for doing this. You have really helped me. I have been trying to implement this using javascript. So cool!
@FFA7046 жыл бұрын
I'm surprised at how fast and potentially actually useful this is
@javidx96 жыл бұрын
Hi Alex, yeah the performance may drop significantly if I get around to texturing though, we'll start to hit the limitations of the windows subsystem which renders the console I think.
@toose83885 жыл бұрын
Woah this series keeps getting more and more impressive! The rotating cube was working fine for me but I can't get any display on my console when I load in vertices from an object file. I've even tried downloading your github repository directly and running it, and get the same issue (so it doesn't seem to be a typo on my end). I will look into my VS and console settings now
@javidx95 жыл бұрын
Im answering these a bit late and out of order, is it possible this was resolved on the discord server?
@CedLePingouin6 жыл бұрын
Hi, I really like your videos. Especially those on 3D programming. I've always wanted to better understand the rendering pipeline, but I did not learn the math that goes with it. Your videos make these topics a bit more accessible. I have a question : at 6:09, isn't line 337 made useless by the following line ? I mean, as an identity matrix, the variable "matWorld" is never used, is it ? It gets immediately replaced by matRotZ * matRotX.
@javidx96 жыл бұрын
Hi Cedric and thanks! It is useless functionally, but visually it reassures me that the matrix is an identity matrix, which if i change the code later i can see the flow of calculation.
@minecraftermad5 жыл бұрын
it was fun when i figured all this out by my self when making my first opengl game and didn't know of any of the libraries etc so i just made my own vector lib (i did end up using the projection matrices etc)
@hippzhipos23854 жыл бұрын
Really learnt a lot of awesome information from this. Thank you very much. Can you maybe do some videos on hardware rendering next ? GPUs maybe ?
@pedrobaltazar27256 жыл бұрын
Man, your video tutorials are awesome!!!
@javidx96 жыл бұрын
Hey thanks Pedro!
@theluca9074 жыл бұрын
Hey, it's been more than two years that this video is out but i have a question, at 47:13, what's inside the two outside_points array (the value, e.g. outisde_point[0])? Because i'm struggling to find it. And i wanted to thank you for your all your videos !! I'm trying to replicate this using lua and the framework Love2D, and your videos are so clear that i can ! Sorry for my english and keep going !
@javidx94 жыл бұрын
This array gets populated with points that lie "outside" the clipping plane. Knowing how many lie outside as opposed to inside informs you whether you need to construct 1 or 2 additional triangles.
@ilikeplanes46163 жыл бұрын
Okay that intro HAD to be a reference to 2001 a Space Odysssey
@GeekTeach Жыл бұрын
Great tutorial! I have been working with my students on a software engineering project and I being the silly teacher I am chose to take control of the Graphics component of our little game. I know much of this in theory, but I was obstinate against moving into triangles. Rectangles should be fine - I've used rectangles with 3d graphics for years. Congrats, you taught an old dog a new trick! Triangles are your friends! Anyway, I did run into a bit of an issue - I don't know if it was converting your code from C++ into C#, but it didn't seem that the clipped triangles correctly maintained their order. I ended up throwing a simple if statement into the code that if you had one internal point and it was the second point of the triangle, reverse the orientation; and if you had two internal points and it was the second point that was trimmed off, reverse the orientation of those two triangles as well. Anyway, thanks for the tutorial, I'm vastly smarter than I was two days ago! 😁
@random_company11 ай бұрын
Dude, you're the best!!!!!
@Summersault6665 жыл бұрын
2001 space oddissey in the begining?
@unhandledexception.6 жыл бұрын
Amazing work ! Thank you for all the effort you put into those videos!
@javidx96 жыл бұрын
Thanks Martin, my pleasure!
@Rraccd6 жыл бұрын
Hey, it wasn’t too long. Perfect, as I was traveling from Cincinnati to Dayton.
@javidx96 жыл бұрын
Hello! Hopefully you were not driving and watching :S
@Rraccd6 жыл бұрын
javidx9 passenger;)
@i_do_stuff Жыл бұрын
Thanks for the tutorial! I finally got it running
@brotherx62055 ай бұрын
for anyone using c++11, when adding the w field to the vec3d struct, you may have to also add a default and custom constructor so that the vector methods don't throw an error when returning an aggregate initializer for the struct
@willsimpson33706 жыл бұрын
question about your "auto dist = [&](vec3d &p)" function: i don't actively develop with c++ so not familiar with its lambda expressions, so what purpose does the proceeding line "vec3d n = Vector_Normalise(p);" serve? visual studio seemingly doesn't give feedback to lines of code that are unused since you don't use n. i'm creating a version of this engine in java and i don't have any issues when i didn't include the line of code.
@javidx96 жыл бұрын
Hi Will, yeah you found an unused line there - I dont like to change the source once the video is made, you get what I make, bugs and all :D. You are correct, VS doesnt care less about lines of code that are unused, and I like that. In this situation if I recall correctly, I was experimenting with different ways of interpreting the distance. It just got left in. Sometimes though, I'll leave bits of code there that I think I'll come back to later on, perhaps this was one of those cases. Lambdas in C++ are not really anything special. For all intents and purposes you can just treat it like a function. The only advantages they offer are to do with scoping.
@jakub8186 Жыл бұрын
There is a mistake in 32:29 , multiplying equation by dx gives c times dx. There should be ydx=dyx + cdx
@floriankopelke91143 жыл бұрын
In the lambda function for calculating the shortest distance between point and plane, the transferred vector p is normalized and saved as vector n. However, the subsequent calculation is carried out using the non-normalized vector p. I assume that this is an error and that vector p has to be replaced by vector n (see video at 45:10).
@floriankopelke91143 жыл бұрын
My assumption is wrong. The vector p must not be normalized, otherwise the following calculation will not be correct. However, I don't understand why normalization is done at this point in the first place.
@MistralKriss4 жыл бұрын
Sir, I could not describe how usefull this serie is, and how gratefull I am, for your work. Still I think there is a mistake (when I saw it, I thought "What ? Is that true ? is this allowed ?" and first I trusted it was ok. But there was a part of my instinct that said, nope something sounds wrong.. So I began to think a bit more deeply and : there's a mathematical mistake, a small one... at 32:20 you state Y = dy/dx*X + C, then you write Ydx = dyX + c, which is wrong. If you multiply the both sides of the initial equation by dx, you get : dxY = dx * (dy/dx X + c) which is (dx/dx)*dyX + Cdx (distributivity) , not (dyX + C) (You forgot to mutiply C by dx)
@CrisMW986 жыл бұрын
45:09 em, vec3d n is nerver used in that function. Did you mean to use n instead of p when returning?
@javidx96 жыл бұрын
Yeah, if i recall correctly, I needed to do an on the fly bug fix whilst filming, and I think some debug code got left in. Oh well!
@---rp3kg5 жыл бұрын
Just like that, you created a 3D game engine... what the hell man O.O
@FrostGamingHype2 жыл бұрын
ever since i watched part 1 and made an 2D Console Graphics Engine I really really want to create something like this like whole genshin impact in the console and its pretty good since triangles are the most common 2D Shapes now if we are using lines insted of triangles the system load will be more high than the triangles because Every Shape will consist of 3 Lines therefore if there is an mountain with 3200 triangles so it would be 3200x3 = no.of lines insted of rendering lines you should render triangles or if you want something more like genshin impact or even gta 5 in the console you can make Anti Aliasing to make the things look more smoother by giving the end parts of the char lighter shade frist draw extra pixels like 2 more char pixels then give the 1 the acctul shade and the 2 the lighter shade of that color
@PCarew6 жыл бұрын
I've gone in a slightly different direction and have added two cameras/ eye positions and am exploring stereoscopic view with red/cyan anaglyphs.
@kallebanan19246 жыл бұрын
Amazing video! One question, how do you run your programs with that fps counter and everything? When I do i get nothing like that, im using the default console.
@javidx96 жыл бұрын
Hi Kalle, I use a utility I created and use for most of my videos called olcConsoleGameEngine, which sets the title bar of the command prompt window amongst other things.
@orangasli29432 жыл бұрын
@44:13 I tried to understand this concept of whether a point lies on a given plane or not (from normal vector calculated by 2vectors of a given triangle).. If I have two vectors a= b= Normal= x*Nx+y*Ny+z*Nz-P*N=0 How to insert the values into the formula? Because I can get 2x+3y=0 or 5x+7y=0 or -z=0
@footballCartoon912 жыл бұрын
to find a point that lies on a selected plane for a given two points (or in this case it is three because of triangle).. 1. since you must select a plane to test, you must have its normal vector in advance.. 2. then, try inserting the points coordinate into the plane's equation..in other words do dot product with the normal vector of the plane 3. if the dot product is in between the plane equation it must pass throught the plane 4. if the vector passes the plane, to find the intersection point you must convert your vector into single variable i.e parametric equation 5. then you find t=dotProduct(N,Q0Q1)/-dotProduct(Q0,N) 6. find x,y,z using formula Q(t)=t*-->Q0Q1 i.e x(t)=... 7. return that vector
@mistervoldemort75406 жыл бұрын
I've been waiting for this video, thank you, another great video! Just a queery: shouldn't the Z axis be poiting in the other sens, in order to follow the right hand rule?
@javidx96 жыл бұрын
Hi Voldemort, no love for left hand rule then? bah, all these righties out there...
@mistervoldemort75406 жыл бұрын
I didn't know the left hand rule existed lol sorry... haha
@Chruschtschowka6 жыл бұрын
"I just use planes because I did the math so" I sense frustum culling
@javidx96 жыл бұрын
lol, have to wait and see :D
@RivenbladeS5 жыл бұрын
Could you please make a tutorial on converting mouse 2d coords into 3d world coords and inverse, selecting individual vertices, objects etc.. into this engine?
@javidx95 жыл бұрын
Hi rivenblades, i touched on mouse ray picking in my Car Crime Game Big Project part 1.
@RivenbladeS5 жыл бұрын
@@javidx9 Oh thanks, I will check it out right now:)
@pyyros1223 жыл бұрын
Loved your video. Could you give some tips on your line drawing function? When I try my machine gets extremely slow (about 10 fps), and In my model I’m drawing far fewer triangles than you are.
@javidx93 жыл бұрын
Thanks, two things I guess. Firstly make sure you are running a release mode build. Secondly, the lines are not clipped, so if you are drawing a line millions of pixels in length (it could be really close to camera for example) then it will draw it all even though you cant see it.
@amyicefyre81066 жыл бұрын
Hey... My Y direction is completely upside down. OBJs are loaded in upside down and adding to camera's y makes the camera move down. Any ideas as to why this may be? Also great video. Love this series.
@javidx96 жыл бұрын
Hi Amy, thanks! It might be something as simple as you have forgotten a "* -1" somewhere in your projection code if everything works ok, but is just upside down.
@SelmeczyAttila5 жыл бұрын
My loaded objects was upside down too so I just changed the vUp vector initialization to this new coordinates: Vector3 vUp = new Vector3(0,-1,0);
@victorhugo-wo2ci2 жыл бұрын
Intro is akin to frontiers elite II how much i love that game lol
@maksymvarivodin598511 ай бұрын
I don't know what is the problem, but it seems to me, that u have ur x-axis(in console engine) inverted, because when created exact same principle code, everything worked the same, BUT horizontally mirrored. I'm currently using quite nice, well-documented 2D graphics library - SFML.
@knssoftware60186 жыл бұрын
Why did I not heed your intro warning... my brain has a memory leak! Thanks though; it was an amazing way to kill off my last grey matter!
@javidx96 жыл бұрын
lol, I agree this video was a bit more intense than all my others, hopefully a one off though.
@ykyjohn4 жыл бұрын
everything was rendering as supposed to until I tried to implement "fYaw", the rendered object now is rendered at the top of the screen instead of the middle. And i only did change things pertinent to the implementation of fYaw. Can't really find the problem. It seems to me that the camera begins rotated in such way that it looks like the object is rendered at the top. but can't really find why!
@brutalmustache95335 жыл бұрын
Really cool. Thanks a lot man.
@javidx95 жыл бұрын
Hey cheers buddy!
@smellthel3 жыл бұрын
epic intro
@Allan_2 жыл бұрын
These videos are really nice and I understand the concepts for the most part, but I don't quite understand why they are used and how. Whenever you explain something it takes me at least 3 rewatches to understand the math. But even then, I still don't understand the purpose nor what it does. Is there any article, video or anything that goes in to the depth of all of these equations and matrix calculations so I can get a better understanding of 3D graphics. I've been able to follow along with your videos in Lua and it works for the most part. I can't get the clipping to work, whenever an object goes to the left, right or bottom of the screen then the triangles don't clip correctly and starting getting huge. If I understood clipping 100% then I could make my own system and wouldn't need to worry about major clipping bugs.
@رضیہالدین6 жыл бұрын
Camera Controls 2.0 with "Sprinting" if (GetKey(VK_UP).bHeld) { vCamera.y += (GetKey(VK_SHIFT).bHeld)? 16.0f*fElapsedTime:8.0f*fElapsedTime; } //Similarly for down, left and right if (GetKey(L'W').bHeld) { vec3d _2F = Vector_Mul(vForward, 2.0f); vCamera = (GetKey(VK_SHIFT).bHeld) ? Vector_Add(vCamera, _2F) : Vector_Add(vCamera, vForward); } //Similar for S if (GetKey(L'A').bHeld) { fYaw -= (GetKey(VK_SHIFT).bHeld) ? 4.0f *fElapsedTime : 2.0f * fElapsedTime; } //Similar for D (Or "acceleration" for turning can be left out entirely)
@javidx96 жыл бұрын
Hey thanks! That's a great contribution, hopefully it should float somewhere near the top so others can see it.
@jacksquirrell4105 Жыл бұрын
At 45:09 you created a 3D vector n that was the normalization of p, but then didn't didnt use that at any point during the rest of the code. What is the point of n?
@jacksquirrell4105 Жыл бұрын
Amazing series btw!!
@humbledcomposer2 жыл бұрын
Javid, were the normals under the edge ring of the lid of the teapot all reversed for you? It looks black but I can't quite tell, and it is for me. Trying to figure out of that was to be expected.
@thefoolishgmodcube26446 жыл бұрын
0:00 Star Fox HD looks neat
@javidx96 жыл бұрын
lol XD
@uvadroid3 жыл бұрын
at 32:28 'c' should be multiplied by dx. How does the rest of the math work out in the end with that error? Is this a glitch in the universe? Only part I didn't get.
@prostomaxym3 жыл бұрын
(C*dx) is still just a constant like it was before multiplication, but yes actually it is a new (C1 = C*dx) constant now. If C value does not matter, it is common way just to skip this clarification.
@KoeWaffle6 жыл бұрын
Nice 2001: A Space Odyssey reference there ;)
@javidx96 жыл бұрын
Hi KeoWaffle, I tried to get the Strauss piece, but it was not royalty free :( Instead I went with Blue Danube, mostly because of the original Elite games.
@defini7Ай бұрын
My message is that it's very important to learn some basics of analytical geometry before watching this video, so you'll understand how to put everything into practice
@yan-amar6 жыл бұрын
34:20 I really don't understand those maths :(
@javidx96 жыл бұрын
Hi Yanamar, with a bit of practice Im sure you will! The nice thing about 3D graphics is that once you have seen the maths it rarely changes - which means so long as you know what it does, knowing how it does it is strictly required.
@MacShrike6 жыл бұрын
Phew.. I'm still with you but I need a drink.. no wait; I drank to much… holidays and all. Ill continue tomorrow. Thank you again..againagain
@javidx96 жыл бұрын
Hi Machiel, I'm just responding to this one of the trail of comments you left. Thanks buddy! (and its ok to drink during the holidays XD)
@pilotandy_com3 жыл бұрын
8:00 - Not for me :( It renders, appears to apply the first iterations fTheta, and then doesn't rotate the next frame. Everything else is right in place. Weird. Edit: Had to initialize fTheta. And the camera for good measure. vec3d vCamera = {0.0f, 0.0f, 0.0f}; float fTheta = 0.0f; Works great!
@getrasa13 жыл бұрын
I got lost at the equations. Isn't y = dy/dx * x + supposed to be y*dx = dy*x + dx*c ? Also how is gradient dy/dx equal to a normal -dx/dy = -Nx/Ny aren't these a completely different slopes, perpendicular to each other?
@alexfish7792 Жыл бұрын
I was curious about this as well.
@GamerSaga Жыл бұрын
Is the code still available for what was shown in the beginning. That ship flying through space with that planet?
@GDevelopisquitenice-py9fj6 ай бұрын
Awesome Series! I'm getting along with this so far, except when I make a dumb mistake, and at the camera movement section I realize that somehow my Y - axis is inverted : adding Y makes it go down and vice versa 😂 I'm rewriting it in python, and also changing the code with python's helpful classes and class functions. Also getting some errors that I can't quite understand but work around them...
@dheerparekh13055 ай бұрын
same issues bro
@MKkniGEAR4 жыл бұрын
You got the clipped triangle winding wrong for the quad case. You inverted the last 2 points for the second triangle, meaning the normal is on the other side. It doesn't change anything visually because we don't use the normal after culling step tho. And also because at this point we're in 2D space and normals don't exist I guess. So is respecting the original winding really important at this point ? Is it so the textures don't appear mirrored ? I guess I answered myself at this point.
@Jacbo16 жыл бұрын
I was understanding everything since the start of the series up until the point where you started showing how to move and rotate the camera. Also, why didn't you scroll over so we could see the code that went off the screen?
@javidx96 жыл бұрын
Well If you need it, all the source is available from the link in the description.
@saltyyolk99346 жыл бұрын
Impressive flat shading.
@javidx96 жыл бұрын
Yeah it looks ok given the limited palette dunnit?
@luizaugusto9421 Жыл бұрын
22:25 47:00 Thanks, man! Very nice you chanel! U got a new inscriton
@peremoyaserra27494 жыл бұрын
I am totally unable to move the camera on the z axis at all and I don't really get why.(up and right work)Any idea?