How 3D video games do graphics.

199,563
92
Published 2020-06-03
We had a fun 3-hour discussion covering some of the basics of how a video game draws pixels on the screen, when it's a 3D renderer. There's a lot more to know than this, but it's a start!

All Comments (21)
  • @SanderVermeer
    For people interested in this topic, John Carmack has an excellent presentation about the Principles of Light and Rendering.
  • @TommyGunsXL
    I fell asleep watching this and when I woke up I had a basic idea of what a shader is and how it works. No joke.
  • @nexovec
    0:00:00 Typical problems during game development 0:08:40 Rasterization 0:16:18 Sight with one eye 0:24:23 Perspective projection 0:35:48 Clipping 0:46:38 Triangles 0:52:40 Faster rasterization 1:00:40 Projection in 3D 1:03:24 Projecting a cheesecake onto a dish 1:08:05 Choosing primitives 1:14:43 LERP, except we don't do that here 1:22:10 Buffer layouts, shaders 1:34:47 Scanlines 1:42:40 Communication between CPU and GPU 1:52:35 The Z Buffer 2:05:50 Z Fighting 2:08:00 When Z Buffering doesn't work 2:10:10 How does translucency work? - Alpha Blending 2:21:25 Solutions for rendering opaque and translucent objects 2:30:56 Current implementation in the game 2:39:30 Chosen solution: Splitting the object 2:45:52 Q&A
  • @FiveNineO
    This is lovely. I wish Jon had more time to teach us newbs glorious wisdom like this
  • @TOWGYB
    Heard these kinds of explanations so many times, and yet still feel amazed at the beauty of the maths behind it all
  • "Remember how mom said don't sit too close to the TV? Well... rip"
  • @buttonasas
    2:43:26 "Then, we will render it twice." My jaw dropped because I immediately realized the rest of the process and how simple it is. This is such an "aha" moment, not unlike ones from puzzle games.
  • @vitasartemiev
    "The guy with the molotov cocktail IS the GPU driver..." I fucking died XD
  • In such a primitive case when you render objects penetrated into flat (water) plane you can split them w/o discard operation in the shader by just modifying camera ViewProjection matrix so that the near clip plane (on the first drawing operation) fits the water plane, so all the triangle clipping will automatically be performed by the rasterizer. On the second draw operation you have to modify the camera ViewProjection matrix so that the far clip plane match the water plane. In this approach you don't have to modify the transparent shaders at all and this won't decrease their performance (which happens with the by-pixel-discard approach). If you are paranoid by the rasterization cracks in the model due to the floating point imprecision you also can tweak the matrices to ensure a little overlapping of the top and lower parts or hide them by other vfx-es (splashes, foam on the water). Also note that the View matrix should be modified only twice per frame independently on the number of the objects to draw. I've did so in a couple of mobile projects without lowering the performance (except for the second pass for each half-underwater transparent object)
  • @trisinogy
    Slowly catching up with your videos. Such a treasure trove of useful tips, insights and knowledge. I do a bit of programming myself, mainly for engineering purposes (C, C++, python etc.); even though I'll probably never code a game or a game engine, I still enjoy listening to how the experts and masters of the trade like you tackle or think about certain problems! There's so much to learn! Thanks for your time and dedication to sharing your thoughts and experiences.
  • @nkinney06
    "light goes in a straight line when gravity isn't too strong", weird gravitational lensing puzzles confirmed
  • @riomh
    Great video, I missed this part of the stream. This video has helped me understand how 3D graphics work much better than I previously did! Thank you so much for spreading this information
  • @anthonyj777
    Thank you for this, it has filled in so many missing links in my understanding of 3D graphics. I finally have a framework where I can start thinking about it all sensibly. Thanks again.
  • @narnbrez
    There are so many channels on YT that answer those easy questions. Not so many that force you to think about the hard ones. Thanks for this Jon.
  • @Thecrazymerio
    A drop of water got on my screen while watching this and I could see the RGB of the pixels behind it as I moved the screen around. Felt like a surreal practical example of light rendering through a transparent surface…
  • @shaner7667
    This was really interesting and informative. Thanks for taking the time to talk about it.
  • @cemdemir1814
    Thanks for this amazing explanation. I was going to watch stream but I'm in different timezone. Thanks for also uploading it to Youtube. It really helps!
  • @RozzmanLists
    Hello Jonathan, it's very kind of you that you grant viewers an insight into how you do things and why. Much appreciated!
  • @WasimAkram0
    Thank you the full deeper explanation even for beginners. Keep up doing awesome work Sir!!!
  • @wowfirebat
    Came for a programming lesson, stayed for the physics lesson.