Texture Mapping & Polygon Rasterizing Tutorial (2/2) [C++20]

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ต.ค. 2024
  • Textured polygons are the foundation of nearly all 3D games in existence. Used before even 3D-capable GPUs were a thing, they were rendered using nothing but software. How was that achieved? Let’s explore an easy and intuitive method. We create an extensible 3D polygon rasterizer using nothing but standard C++20 (and libSDL for 2D graphics).
    Become a member: th-cam.com/users/Bi...
    My links:
    Twitter: / realbisqwit
    Liberapay: liberapay.com/...
    Steady: steadyhq.com/e...
    Patreon: / bisqwit (Other options at bisqwit.iki.fi...)
    Twitch: / realbisqwit
    Homepage: iki.fi/bisqwit/
    You can contribute subtitles: www.youtube.com...
    Downloads:
    bisqwit.iki.fi...
    Music list (s = SPC-OPL conversion):
    - Super Mario RPG ­- Sunken Ship (s)
    - Tales of Phantasia - Final Act (s)
    - Final Fantasy V - World 1+2 (s)
    - Famicom Tantei Club 2 - Interviews (s)
    - Energy Breaker - Heroes’ Adventure (s)
    - Final Fantasy Mystic Quest - Shrine (s)

ความคิดเห็น • 232

  • @Bisqwit
    @Bisqwit  4 ปีที่แล้ว +40

    Here is a patch that fixes the staircase error in the right edge of the texture:
    - bisqwit.iki.fi/jkp/polytut/patch-fix-rounding-error.txt
    Here are some links to material you can study.
    Perspective projection:
    - en.wikipedia.org/wiki/3D_projection
    Vector math:
    - en.wikipedia.org/wiki/Vector_%28mathematics%29
    Matrix math:
    - en.wikipedia.org/wiki/Transformation_matrix
    - en.wikipedia.org/wiki/Affine_transformation#Image_transformation
    - en.wikipedia.org/wiki/Matrix_%28mathematics%29
    Quaternions:
    - en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Using_quaternion_as_rotations
    - en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Quaternion-derived_rotation_matrix
    - en.wikipedia.org/wiki/Quaternion#Hamilton_product
    Plane:
    - en.wikipedia.org/wiki/Plane_%28geometry%29
    Polygon clipping:
    - en.wikipedia.org/wiki/Vatti_clipping_algorithm
    - en.wikipedia.org/wiki/Greiner%E2%80%93Hormann_clipping_algorithm
    - en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_clipping_algorithm
    - en.wikipedia.org/wiki/Weiler%E2%80%93Atherton_clipping_algorithm

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

      if i were a woman i'd marry you

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

      Hello, you described the used library as SDL in the description, but it's SDL2... Not really anything important, just wanted to mention it...
      Apart from that, this video was even better than your usual.
      EDIT: Just to say, I already knew texture mapping, but I decided to look at your video anyways, and it sure is a good thing. Using ordered dithering on the textures is pure genius!

  • @FODKOM
    @FODKOM 4 ปีที่แล้ว +159

    Bisqwit, hope you are staying well. Your knowledge is sacred in the wired world. Can't believe you are releasing this for free, as information flows. You are the keeper of the golden knowledge basket. Shalom indeed. God bless.

  • @clintonevans2226
    @clintonevans2226 4 ปีที่แล้ว +51

    Hi, Bizqwit. As a 40+ year old that started to learn programming a few years ago, I enjoy just watching and listening (even if I do not understand much). Hopefully this will become my "old man" hobby like trains or gardening. You really are able to show the beauty of rendering and gfx engine coding coupled with the passion of self motivated learning. I just wanted to say thanks and I hope both of us can find the time in future to do more coding :)

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

      The problem is that fluid intelligence and memory decline precipitously after about age 23 so don't wait too long!

    • @adagas-caouchristian7875
      @adagas-caouchristian7875 4 ปีที่แล้ว +8

      ​@@c0xb0x Maybe so, but motivation and passion come and stay at any age - If both are kept lit, I think that they far outweigh the consequences of our brains' aging. I do hope that even after decades you will continue to enjoy your hobbies as much as ever!

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

      @@adagas-caouchristian7875 i lost passion in everything i was doing before 16 years :(
      but it's what i want to do in my life, for some reason my brain thinks it's boring 😤

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

      There are a couple "old people" (40s and 50s) in my school learning programming as first-timers, and they're doing better than many of the 20s and 30s. Keep it up, don't let anybody imply it's too late!

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

      Hi, how has your programming journey been over the past 4 years?

  • @malbacato91
    @malbacato91 4 ปีที่แล้ว +46

    10:13
    "array called ARRRH" threw me out of guard :lol:
    EDIT: your pronunciation of חג שמח is surprisingly accurate

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

      10:10

  • @DarianCabot
    @DarianCabot 4 ปีที่แล้ว +11

    26:29 "...and nothing does not not fail to work" 🤯

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

    Oh by the way, this was the vector mathematics library that I wrote 5 years ago when I was working on this project. You can really see a difference between this and in what I showed in the video. This would have been _horrible_ to parade on the screen.
    pastebin.com/rQRKMKYr math.hh
    pastebin.com/7nH7y8Rm math_simd.hh

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

    ooh, Immediately Invoked Lambda Expression. Your C++ expertise is A++

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

    LOL
    _"Of course there are some dithering artifacts now, but if you watch this video in _*_160p,_*_ you totally cannot even notice them."_

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

    Each time my notification bell rings, I cross my fingers in the hope it's one of your videos...
    And what I got here was way more than satisfaction.

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

    I just watched Part 1 and was wondering when this would come out, I went to the youtube homepage and saw that this was just posted! I love these videos!
    7:54 - I had this problem too, I wrote a polygon software renderer a few years ago so watching you work through the same problems I had is interesting and awesome

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

    26:50.
    I feel you bisqwit. As wonderful as computers are to use and program, they also separate us and promote individualism. It's easy to slip into depression when the world just wants to be alone and watch TH-cam and Netflix (especially in the winter, and even COVID quarantine). The best we can do is to love our craft, and then to give and show others kindness in our daily lives (much like you and your generous tutorials).
    Warmer days ahead, and stay safe amongst COVID.

  • @MeepMu
    @MeepMu 4 ปีที่แล้ว +25

    18:02 someone has been watching chubbyemu :)

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

    Thanks for the shout out Bisq! I appreciated playing with these algorithms but felt I could not understand well what they did with the verbose and odd syntax more modern C++ has taken on for me. As a result I have gone to C as I find it more suited for my purposes in gamedev, but it is only what I feel benefits me in specific, not everyone will agree with my choice. Nevertheless your videos have inspired me in the first place to search out for the technicalities of games and software and I am glad you have taught me lots of things. Onto the next topic!

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

      How about just _not_ using those features instead?
      You aren't forced to cram new features everywhere.
      Why make the switch to an outdated obsolete language that frankly is _terrible_ for making games in?

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

      @@pendergastj I second this. While C can arguably have its purposes, for (general purpose) game development it is far from ideal. Also I have no idea why OP switched to C from C++ when C++ supports everything from C and more.

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

    Fantastic resource for learning computer graphics and rendering algorithms, thank you Bisqwit!

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

    Absolutely amazing stuff man, mesmerising :) I wish I had your insight and access to this channel back in the 90s when I worked on my own 3d engine on the Amiga 1200 of all things. I had a texture mapper and fast flat shader (using some 68020) working with bitplanes (first on ST) and had a sparse 'moon' I could run around and jump in with a few 3d objects. But perspective correction and particularly frustum clipping gave me a really hard time and seeing you break it down so eloquently is a joy to behold. Was worth all my effort in the end though as I used the demo in a showreel which got me started in the games industry. Keep up the good work Bisqwit, you are inspiring and a legend and should be very proud of this.

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

    Very cool! I want to make 3D engine in Scratch and I am very thank to you for explaining clipping!

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

    "Especially when ones mind is prone to depression."
    Atleast you manage to get things done in your freetime.

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

      Try taking some magic mushrooms. May give you a new perspective.

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

    Oh god, I was literally looking for the Bayern dithering for years now, didn't know the name back then. But not because of the speed, but the looks! Seen it in some 90's games, and very much liked it.

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

    i suffer from depression and lack of inspiration aswell! i hope you're doing well and im glad to see the wheels turning again!

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

    You are so amazing and I really look up to you, I wish I was as good as you at programming :O

  • @GabrielPiveta
    @GabrielPiveta 4 ปีที่แล้ว +28

    I love your videos. But as a C programmer I get really confused with this code 😂

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

    God, Bisqwit would be a perfect teacher.

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

    Fantastic video.
    I always wondered how perspective correction was applied to textures.

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

    After discovering Bisqwits my pull-request started to take twice as long to get approved. 🐱‍👤

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

    You are just amazing. And I feel like I am touching the future, yet with the acient editor and UI.

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

    I like that nod towards chubbyemu at 18:00

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

    Thank you so much for these incredible videos!! I can't wait to see more C++ graphics videos. Hope you are well :)

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

    Hang in there - you're awesome and so is your content. Really appreciate this, so keep on going! Thank you!

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

    I heard a sizzling noise that was my brain frying when you started going over all the mathematical concepts.

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

    Awesome :) a challenge could be to create a distorted sprites renderer, just like the saturn had in hardware, distorting sprites corners shouldn't give away the diagonal appearing in distorting quads when using two triangles on them. The restriction on distorted sprites is that the opposites edges of a quad render the same amount of texels, in other words, the mapping coordinates of a quad are always a quad. Keep the awesomeness 👌

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

    I really like your content, please never stop doing this!

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

    Keep making videos like this.
    I really like your channel. Thanks for these free informations.

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

    You used Unreal-style dithering for texture coordinates

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

    19:35 bisqwit goes into the 6th dimension

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

    Personally as a huge ps1 graphics fan, I love the look of affine texture mapping!!

  • @DjVortex-w
    @DjVortex-w 4 ปีที่แล้ว +16

    Perspective-correct texture mapping is not something that's very often nor clearly explained, neither in videos nor at any websites and tutorials. (The _concept_ of "perspective-correct texture mapping" is often explained, but not the actual way of doing it, the actual math needed.) This even though it's one of the most fundamental things one needs to know if one wants to implement a scanline renderer of any sort (or at least one that supports texturing).

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

      That's likely because it's taken for granted. We haven't had hardware 3d implementations that don't implement it since about 1996...
      And the reasons for doing affine vs perspective correct texture mapping in software are almost entirely performance related. (depending on your underlying computer architecture, Affine texture mapping can be anything from 3 to 20 times faster than perspective correct mapping.) - thus this became less relevant over time, and I guess people gave less thought to bothering to explain the difference or how it works...
      I prefer older books for this subject, because they tend to explain both what it's about, why it's implemented and show variations of both affine and perspective correct mapping algorithms.
      Having said that, the current wikipedia article describes the mathematical basis well enough (if you understand mathematics of course)
      en.wikipedia.org/wiki/Texture_mapping
      Technically this tells you all you need to know, but may not be the easiest thing to interpret.
      Still, it can indeed be frustrating dealing with your average modern tutorial on the subject...

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

    Ouch... Quaternions are one of those things...
    As purely mathematical objects they are pretty hard to follow.
    There's a whole class of higher dimensional versions of them that have no known practical purpose. But for some reason the 4 value one turns out to have uses in 3d graphics...
    Though if it helps, the best explanation I ever came across for what a quaternion is doing, as it applies to 3d transformations is that the quaternion defines a plane in 3d space, and then a rotation around that plane.
    In other words, it defines an arbitrary angle of rotation around an arbitrarily defined 2d plane in 3d space.
    It of course also has the useful property (much like matrices) that if you combine two quaternions together (I forget the actual mathematics of it), you get a quaternion that combines the result of applying both quaternions individually.
    (Also you can interpolate between two Quaternions and the result will be a smooth transition between the two.)
    I've forgotten a fair bit of the details, but it was actually pretty interesting learning what a quaternion technically defines.
    In a way you could argue it's a geometric transformation in 4 dimensions rather than 3.
    But nonetheless the practical effect is that it defines not only an angle of rotation, but also the plane on which this rotation takes place...

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

    ok... I just really like your honesty about quaternions... hahaha

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

    Question, did you have time to research webassembly and if so any interesting insights on the in-browser possibilities?
    Happy holidays keep safe this season.

  • @elmonni2103
    @elmonni2103 4 ปีที่แล้ว +11

    SHALOM!!!

  • @peter.bacinsky
    @peter.bacinsky 3 ปีที่แล้ว

    This was brutal

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

    hey Bisqwit, 1+2+4+8+16+32+64 == 127
    Fun video. Thanks for the intro to SDL - it's new to me! I'm impressed that you grabbed hold of C++20 so rapidly. I'm still on C++17...

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

      Experimenting is the way to learn…

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

      @@Bisqwit absolutely. I have no excuse...

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

      @@treyquattro Your comment was put in "held for review", and I deleted it. Do not reply to the spam bots. It does not do any good. There is no person reading the feedback, it’s a 100% automated hit-and-run campaign. And I will eventually delete the spam; it’s just tons of work. I have deleted like 800 of those so far, and it has to be done one by one. Each of them involves like 4 clicks. TH-cam is not really well equipped to deal with this.

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

      @@Bisqwit Thanks. I'm just venting, mostly at UselessTube for their inability to do anything about this infestation (it's usually bitcoin pump & dumpers). I usually report the offenders, but of of course the people at TH-cam are just sitting on their asses doing nothing but getting rich. I'm glad someone on is on the case. I don't envy you. Godspeed, Bisqwit. (I presume the process can be automated, or at least streamlined. I noticed they're getting smarter about trying to avoid NLP. I actually thought that was pretty smart of the spammers, and most likely a reason why YT is ineffectual)

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

    Your videos are very enjoyable. Thank you :)

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

    Depends on your high school I guess.
    When I was doing exams at the end of high school we had 3 maths classes with their own exams.
    They go by the rather unimaginative names of Maths A, B and C.
    You cannot do all 3.
    You either do Maths A, or you do Maths B...
    Maths C is optional, but you have to be doing Maths B to do Maths C
    In any event, both Vectors, matrices and even quaternions show up in the Maths C exam...
    Roughly speaking the 3 types of mathematics correspond to career paths.
    Maths A is basically for if you were going to be an accountant or bookkeeper or the like, or were intending to study something like Economics.
    Maths B is the most general, but also leans towards science and engineering uses.
    Maths C is 'advanced' mathematics, and again leans towards science and engineering (And of course anyone intending to study mathematics explicitly as a subject.)
    Anyway, you just reminded me of my exams. Thanks. ;p
    Also, it's interesting to hear you explain something as relatively unimportant as your coding style. Makes sense that you'd want to show as much of a program as reasonably possible onscreen at once.
    Nothing more annoying than 'coding style' pedants though... XD
    Or the people that argue about definitions, insisting theirs is the only valid point of view.
    Got into an extremely tedious argument with someone once about what, precisely, 'pass by reference' means.
    I pointed out there is widespread usage of this term throughout many sources of this being any kind of indirect way of passing a data structure (like, say, using a pointer), they insisted that the many sources I could easily show them were all 'wrong', and that it exclusively meant the C++ 'reference' type, and nothing else.
    In the end what's annoying about that is that it's so... unimportant.
    It's the worst kind of pedantry.
    With things like that what matters is that people understand one another, not whether any given definition is 'correct' or not...
    But, such seems to be the nature of programmers. Which I guess makes sense given how small errors in code can create huge problems.
    It's still incredibly annoying to endlessly have to deal with the most pedantic people in existence though.

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

    Its a shame that this series is coming to an end already.
    I look forward to your next project Bisqwit.

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

      The series is not actually coming to end yet! I have only just gotten started. There is a lot that I want to do and I am already working on it.
      But I made these first two parts into a two-part series, because together they form a coherent topic. Thanks for commenting!

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

      @@Bisqwit Can't wait to see you work on some more 3D graphics then. Its a great interest of mine and you tackle the topic in an interesting and enjoyable to watch way.

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

    For a in depth Quaternion insights Visualizing Quaternions is a book full of stuff.

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

    Another excellent video thank you so much!

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

    neat! great video + explanation

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

    You're an actual God.

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

    Wowwwww this is amazinggggg😀

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

    Thank you

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

    Wasn't that ending sequence test hidden in some other video? I could have sworn I've seen something similar -- perhaps on the DOS OpenGL thingy? I always wondered if it would get made into a full video; I guess now it has!

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

      I have teased on it a few times along the years, but I don’t think I have ever shown that particular clip.

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

    Specially when ones mind is prone to depression... Lots of programmers relate to that, me included :/
    PD. Loved the last song

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

    Great video! Does a Z-buffer store inverse-Z values? I think working in the inverse-Z space helps avoid Z-fighting issues for triangles far off in the distance.

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

      The Z-buffer stores real Z values in my code. However, you could just as easily make it store inverted values instead and just flip the comparison. Interesting idea regarding Z-fighting. Would need to test it to verify if that’s the case.

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

      Isn't this called a W-buffer?

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

    bisqwit... returns : D

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

    Small correction: Anti-aliasing and linear texture filtering are not synonyms. Anti-aliasing tries to make polygon edges fuzzy, while texture filtering makes texel edges fuzzy.

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

      Addressed on the annotation on screen. This distinction is artificial in nature due to distinct implementation mechanisms. In terms of outcomes to achieve, both are antialiasing. Aliasing (whether it is graphics, sound, or any measurement) is when a sample has to pigeonhole into _one_ target (such as _one_ texel of _one_ polygon). Anti-aliasing is whenever artifacts arising from this phenomenon (such as jagged appearance or non-effect of skipped-over samples) are mitigated.

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

      @@Bisqwit Sorry, I had annotations disabled :( You're right, both are measures against aliasing. However in computer graphics jargon word "anti-aliasing" seems to reserved for smoothing polygon (or other rasterized shape) edges.

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

      The annotation I referred to is burnt in on the video. TH-cam’s “annotations” were permanently deleted little more than a year ago.

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

      @@Bisqwit Oh, there! I guess I was too concentrated reading the code to notice that in first time.

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

    good as always

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

    This is the real code lyoko

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

    Great videos! 😁👌

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

    I like that "I never neen there" (University)

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

      Yeah, that was true when I made the video!

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

    Very nice Bisqwit, I'm a fan from Brazil! ;D

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

    I know you're trying to keep all the code readable on the screen but through the process of condensing and refactoring you're actually making it harder to understand. This is pretty heavy stuff I wouldn't mind if it were spread out longer for the sake of making it easier to understand.
    Keep up the great work though I still enjoy all of it.

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

      My mathematics library for this project initially looked like this.
      pastebin.com/rQRKMKYr
      This would have been _so_ tedious to go through on screen. The current version is much less painful.

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

    Great video as always. Explained the topic very well, but i have some questions regarding your c++ style more than anything.
    You make great use of Lambda functions, but i cant really figure out why.
    For example, with the Perspective(Un)Project and MakeFrustum lambdas, wouldn't it be more typical to make them regular functions, and if they dont need to be a function, why is it a lambda, and not just a regular block of code?
    Hope someone can give an answer to this. I am new to C++, and looking to improve :-)

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

      Scoping is the reason. To keep related things closeby. Lambda is a solution that allows you to keep related code very close to where it is being used, rather than shotgunning everything everywhere. The series is not over yet though. In every episode I have refactored the code once or twice, and it will keep happening.

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

    will you try make ur own library like libSDL in future (to handle 2D)?

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

      No. There would be _so_ _many_ cases to handle, like different APIs, different OSes, to no end. No thanks.

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

    Thanks for the lesson, Master Programmer

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

    A true Viking Programmer

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

    6:30 Hey @Bisqwit, I had been looking up quaternions and I did not understand it well at all, but I recently found a Wikipedia article on "Rodrigues's rotation formula", which can be used to rotate a 3D vector by an angle about another 3D vector. It only uses cosine, dot products and cross products, not even any matrices. Somehow I found this much more understandable than the usual business of converting vectors to quaternions, performing the rotation, and converting back to vectors. Seeing as how the formula isn't widely taught I thought I should draw attention to it as an alternative to quaternions when doing 3D math: en.wikipedia.org/wiki/Rodrigues'_rotation_formula

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

    Nice code style

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

    I feel so bad for ever smiley at the end of every line..

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

      );

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

    こんにちは Bisqwitさん ;D

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

    Thank you for the video! Do you have any videos on Vulkan API?

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

      No. I cannot imagine any possible way to make Vulkan interesting, considering that its “hello world” example is like 200 lines of boiler plate code.

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

      @@Bisqwit there are a lot of open source libs which hide all the boiler plate code giving you the clean space to do pure Vulkan stuff.

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

      By then it’s not so much a tutorial on using Vulkan than it’s a tutorial on using that particular open source library.
      I did use SFML in my 75000 subs demo (in addition to OpenGL) because it was not a tutorial, but in videos that are intended for teaching, I try to keep dependencies as close to zero as possible.

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

      @@Bisqwit are we still talking about the boilerplate code? Because what you mean is a graphics engine. When coding for opengl do you use GLUT or similar tool lib?

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

      When I am making videos, I try to keep dependencies as close to zero as possible.

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

    Hello internet, Im from Indonesia !

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

    27:21 You are entering the first level on Descent trough the exit, right ?

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

      Yup, that’s right.

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

    My regular mind is burning

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

      Time to switch to your special mind then!

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

    Do you have github profile. I want to learn by reading code. Video is fast 😭

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

      This is mine, but not nearly all my projects are there. github.com/bisqwit/

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

    4:03 ... it's been 4 years! are you still planning to make that video?

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

      Thanks for reminding me!

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

      @@Bisqwit you're welcome!

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

    Where can I learn C++20? There are not many books for this standard released yet.

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

      You asked the same (similar) question two weeks ago. I replied:
      en.cppreference.com/ - Reference manual on all things C++ (look for things that say C++20; Wiki, so it’s updated once in a while)
      en.wikipedia.org/wiki/C++20 - Summary; search for things that pique your interest or click the reference links
      gcc.gnu.org/projects/cxx-status.html - TODO/status list for GCC, including links to the proposals that describe the feature (quite technical)
      gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2020 - TODO list for the standard library component of GCC, including links to the proposals that describe the feature (quite technical)
      These are my four main go-to resources on new things C++. Also for keeping up to date with C++ news, there are several subreddits, such as reddit.com/r/cpp

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

    damn, I need to up my game. Quaternions ftw

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

    Are you able to make the full code available from a link to a website where i can copy and paste the full finished code? I am planning to convert this into a code for use in the arduino software if that is ok with you. Thank you.

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

      The download link is in the video description.

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

      @@Bisqwit Thank you very much!

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

    Why did people go with tris, instead of quads, with the texture coordinates and stuff simply interpolated based on tweening between 4 corners?

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

      As I've heard, that's what the Sega Saturn did

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

    Arrays go arrrrrr

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

    Do they really want one to use range based for loops for filling arrays i thought it makes sense to use std::fill_n? But maybe it’s equal in performance.

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

      It makes absolutely no difference. “Fill memory region with given value” is one of the simplest patterns identified by a compiler and no matter how you write it, it will essentially generate same code for it.

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

    Hey Bisquit, did you tried Rust?

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

    yo, quick little repeated question, what is your job?

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

    Can you make a video on what if graphics ere rendered asynchronously?

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

    This question keeps lingering in my mind, since a lot of people contradict each other, so please, Bisqwit or someone else answer me: in what cases should one use c and in what cases should one use c++? And what are the pros and cons of each language?

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

      Many people would disagree with me, but for me, it’s “use C only if C++ is not available”.
      There was a point in my life when C++ was to me “C with shortcuts that make life easier”. That was about 25 years ago.
      Then I discovered modern C++, which had been just standardized, and that’s when the situation changed. Since then, C has been to me “C++ with handicaps”. And those handicaps have grown bigger and bigger by the year.
      To others, I would say “use C++, unless 1) C++ is not available, 2) you are very familiar with C and don’t know how to make use of C++”. There may be a few other reasons, such as “3) you are writing a library that you want to publish, and you only want to distribute it in binary form and you have settled on a very stable API that is unlikely to change in the coming decades” and “4) your C++ is atrocious”. ;-)

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

      Thanks for your answer. As a follow-up question I want to ask you: What about using C for system programming. Is it justified in such a case? And even when using c++ in the case of system programming, would the performance difference be significant?
      And concerning multimedia libraries: why use SDL over SFML and vice versa?

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

      My previous answer also covered situations like system programming.
      As for comparing SDL against SFML, the overall thing is that SFML is a vector graphics library while SDL is a pixel graphics library. While it is possible to cross the domains either way, that’s how they are designed. I tend to do mostly pixel graphics.

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

    Who else is watching at 160p to not notice the dithering? :-P

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

    he just said hes never been to uni...let that absorb into your head.

  • @112BALAGE112
    @112BALAGE112 4 ปีที่แล้ว

    I don't quite understand this "inverted z coordinate" thing. Shouldn't homogeneous coordinates be used instead?

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

      Inverted means 1 divided by the value.

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

    Very off topic question (very!). Since i value your knowledge and insights from work. religion to programming im wondering about...your diet! Any rules or guidelines on what you eat? What do you drink usually during the day?

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

      I loosely follow the kosher diet, which means I don’t eat pork or shrimp among a few other things, but other than that, I’m quite flexible. Mostly I drink water. I always have a water bottle that I fill with tap water. We have very clean tap water here in Finland. At work I also drink coffee throughout the day, but at home (even while working remotely) not so much. I don’t even have a coffee machine. Sometimes I have red wine.

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

      ​@@Bisqwit Do you eat sugar/candies often?

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

      No. I am gaining weight much more easily nowadays than I did 10 or 20 years ago, so I try to keep those to rare occassions.

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

      @@Bisqwit Same here. Thank you for the info. I hope you will have time for more videos on the Extra and Bible channel soon. Although i not always agree with your non-tech related opinions i, as i said before, certainly value them. And i think this goes for more of your followers than you can imagine.

  • @Kawa-oneechan
    @Kawa-oneechan 4 ปีที่แล้ว

    Ladies and gentlemen, we have a Playstation-tier texture mapper XD

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

    which linux distri you use ????

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

    Here's the weird question
    Can you track God with programming?

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

      Weird question confirmed.

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

    your starting assumptions, if forced, will make you are prisoner of them

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

    I ask for help, so that you provide an Indonesian translator, because of your TH-cam videos, it is very useful for us beginners, thanks in advance, and thanks back to you if you see my comments.

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

      My videos have community translations enabled. Anyone can submit translations for video title, video description, and captions. _I_ don’t speak Indonesian, but many of my recent subscribers do, including, I suspect, you. Click the link in the video description for details.

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

    How did you make the bloom? Gauß maybe?

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

      In my video editing software, I added the same video twice to the same spot in the timeline. One with a blur filter applied on it, and without. The one without is rendered atop the blurred one.

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

      Bisqwit Ohh i thought it’s done in the renderer ;)

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

      No, there was an annotation on the screen explaining that the stars, the bisqwit logo and the bloom were added in postprocess.

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

    siipaspas proukramming 🤣🤣

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

    3blue1brown has good video ob linear algebra and quaternion

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

    Is it true this guy works as bus driver ?

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

      It’s true I worked as a bus driver at some point. But you know, time passes and stuff. Not all of my videos were made yesterday.

  • @GbpsGbps-vn3jy
    @GbpsGbps-vn3jy 4 ปีที่แล้ว

    48 cpu threads? Ok, what's the cpu model?

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

      3960X