Course description

This is one of my favorites!

This course is a complete immersion into the fundamentals of computer graphics! You'll learn how a software 3D engine works under the hood, and use the C programming language to write a complete software rasterizer from scratch; including textures, camera, clipping, and loading complex OBJ files. Pixel per pixel, triangle per triangle, mesh per mesh.

3d programming from scratch

We'll review all the beautiful math that makes 3D computer graphics possible as we tackle all concepts from first principles. We'll also write a comprehensive software renderer that can display complex 3D objects on the screen without the help of any graphics API. No GPU, no OpenGL, no DirectX! Just a C compiler and a little bit of linear algebra is all we need to create a final project that is nothing short of amazing!

The tools you'll need

We'll simply use the command-line, a code editor, and a C compiler. All these tools are multi-platform, so you'll be able to code along on either Windows, macOS, or Linux!

operating system

Also, make sure you have pen and paper ready for the lectures. This course will probably be a little bit different than other programming courses you took before. We will take our sweet time and make sure we understand every formula we find along the way!

game math

Is this course for you?

3d programming tutorial

This is a self-contained course with no prerequisites. However, you will probably get the most out of it if you already know the basics of coding (if-else, loops, functions).

If you never programmed in C before, don't worry! Many successful students come from different languages like Java, Python, JavaScript, Swift, and others. We'll learn to work with the C language together.

About the instructor

gustavo pezzi

Gustavo Pezzi is a university lecturer in London, UK. He has won multiple education awards as a teacher and is also the founder of pikuma.com.

Gustavo teaches fundamentals of computer science and mathematics; his academic path includes institutions such as Pittsburg State University, City University of London, and University of Oxford.

teaching certification
higher education academy
pgclt teaching certification
bpp university award

Course content

37 hours total length 29 Chapters Last updated March 2023
  • Motivations & Learning Outcomes
  • How to Take This Course
  • Configuring Dependencies
  • Project Folder Structure
  • Configuring a Makfile
  • Compiling on Linux
  • Compiling on macOS
  • Configuring Visual Studio on Windows
  • Creating an SDL Window
  • Declaring a Color Buffer
  • Allocating and Freeing Memory
  • Quiz: Memory Allocation
  • SDL Texture
  • Fullscreen Window
  • Exercise: Drawing a Background
  • Drawing Rectangles
  • Quiz: Color Buffer
  • Defining Header Files
  • Quiz: Header Files
  • A Function to Draw Pixels
  • Vectors
  • Declaring a Vector Type
  • Declaring Structs
  • Array of Vector Points
  • Quiz: Vectors and Points
  • Orthographic Projection
  • Isometric Projection
  • Perspective Projection
  • Implementing the Perspective Divide
  • Coordinate System Handedness
  • Quiz: Perspective Projection
  • Transforming Vectors
  • Review of Sine, Cosine, and Tangent
  • Quiz: Trigonometric Functions
  • Rotating Vectors
  • Proof of Angle Sine Addition
  • Proof of Angle Cosine Addition
  • Quiz: Rotating Vectors
  • Fixing our Game Loop Timestep
  • Using a Delay Function
  • Constant Framerate and Variable Delta Time
  • 3D Triangles and Meshes
  • Vertices and Triangle Faces
  • Triangle Edges
  • Quiz: Joystick Input
  • Line Equation
  • DDA Line Drawing Algorithm
  • Do We Need Bresenham Lines?
  • Coding a Function to Draw Lines
  • Dynamic Arrays in C
  • Dynamic Mesh Vertices and Faces
  • Defining the Project Playfield Graphics
  • OBJ File Vertices and Faces
  • Exercise: Loading OBJ File Content
  • OBJ File Triangles and Quads
  • Introduction to Back-face Culling
  • Vector Magnitude
  • Vector Addition
  • Vector Subtraction
  • Vector Scaling
  • Vector Cross Product
  • Finding the Triangle Normal Vector
  • Dot Product
  • Implementing the Back-face Algorithm
  • Vector Normalization
  • Quiz: Vector Operations
  • Triangle Fill
  • Flat-Top & Flat-Bottom Technique
  • Flat-Top Triangle Code
  • Flat-Bottom Triangle Code
  • Avoiding Division by Zero
  • Exercise: Different Rendering Methods
  • Solid Color Triangle Faces
  • Painter's Algorithm
  • Exercise: Sorting Faces by Depth
  • A Simple Sorting Function
  • Matrices Review
  • Matrix Operations
  • Matrix Multiplication
  • Exercise: Matrix Multiplication
  • 2D Rotation Matrix
  • 3D Scale Matrix
  • 3D Translation Matrix
  • 3D Rotation Matrices
  • The World Matrix
  • Order of Matrix Transformations
  • Quiz: Matrix Transformations
  • Translation is Not a Linear Transformation
  • Defining a Projetion Matrix
  • Populating the Perspective Projection Matrix
  • Exercise: Projecting Negative Z Values
  • Projection in OpenGL & DirectX
  • Row-Major and Column-Major Order
  • Flat Shaded Triangles
  • Coding Flat Shading and Light
  • Smooth Shading
  • Gouraud Shading & Phong Shading
  • Representing Textures in Memory
  • Textured Triangles
  • Textured Flat-Top Triangle
  • Textured Flat-Bottom Triangle
  • Barycentric Coordinates
  • Barycentric Weights (α, β, γ)
  • Coding Textured Triangles
  • Quiz: Texture Mapping
  • Perspective Correct Interpolation
  • What Does "Affine" Mean?
  • 3D UV Coordinates
  • Decoding PNG Files
  • Loading PNG File Content
  • Freeing PNG Textures from Memory
  • Quiz: PNG Files
  • Loading OBJ Textures Attributes
  • Preventing Texture Buffer Overflow
  • Rasterization Rules
  • Visualizing Textured OBJ Files
  • Implementing a Z-Buffer
  • Exercise: Z-Buffer for Flat-Shaded Triangles
  • Z-Buffer for Flat-Shaded Triangles
  • Reviewing Dynamic Memory Allocation
  • Camera Space
  • LookAt Camera Model
  • LookAt Camera Transformations
  • Implementing a Variable Delta Time
  • Coding a Simple FPS Camera Movement
  • Quiz: Camera Transformations
  • Frustum Clipping
  • Frustum Planes
  • Exercise: Frustum Planes and Normals
  • Computing Points Inside and Outside Planes
  • Intersection Between Lines and Planes
  • Clipping Polygon Against a Plane
  • Coding the Function to Clip Polygons Against Planes
  • Visualizing Clipped Triangles
  • Horizontal and Vertical FOV
  • Clipping Texture UV Coordinates
  • Clipping Space
  • Quiz: 3D Clipping
  • Deciding What Not to Render
  • Working with Static Variables
  • Refactoring SDL Global Variables
  • Refactoring Light Code
  • Simulating Low-Resolution Display with SDL
  • Exercise: Camera Pitch Rotation
  • Implementing Camera Pitch Rotation
  • Declaring Multiple Meshes
  • Coding Multiple Meshes
  • Coding Multiple Textures
  • Finishing our Code
  • Bonus Lecture: Handedness & Orientation
  • Bonus Lecture: Dedicated Graphics Cards
  • Bonus Lecture: Modern Graphics APIs and Shaders
  • Modern 3D Hardware Techniques
  • Moving Forward

How is this course different?

This course is not just a simple tutorial on how to use an existing graphics library or how to glue OpenGL or Vulkan code together. This course focus on the foundation of 3D graphics and provides a careful review of the math that underpins these concepts.

3d software renderer

If you want to understand how computers display 3D objects on the screen and also learn some of the techniques used in the development of retro 3D games, then buckle up! This is going to be a 35-hour journey of pure nerd fun!

What students are saying

4.98
5 star
97.8%
4 star
2.2%
3 star
0.0%
2 star
0.0%
1 star
0.0%
"Amazing! It is a comprehensive content and an easy-to-follow pace, you'll be impressed by the results. I am very grateful for taking this course, thanks a lot Gustavo!"
25 May 2023
Carlos Alfredo Castillo
Carlos Alfredo Castillo
"Great introduction to 3D Graphics. There are many graphic programming courses out there, but this is great as an introductory course that will make you reflect and understand every step in the graphic pipeline in a progressive way, specially it will make you understand the necessary math to tackle graphic programming and continue your studies in this area if you felt so inclined. Also, much better than reading a book because Gustavo is such a great professor that you will understand everything. 100% Recommended!"
25 May 2023
Sapan Shrestha
"A great course that needs a little more support. Love the course but I'm seeing questions go un-answered. The LMS system is a bit underdeveloped. There's no way to track your own questions, I wish the author would start a discord where students and community could help each other out. There's no doubt about the authors ability to teach and the content is excellent. I just wish the UX was better. Cheers."
24 May 2023
Mikko Melts
"Hey Gustavo!

Id like to say thanks to you in a review of the graphics programming series, this course really helped me not only understand the details of what goes into rasterizing an image and the vector math etc, but also gave me plenty of confidence in my own ability as a programmer aswell!

I read the comments to your lectures and implemented the triangle rasterization techniques i learned from Fabian Giesen's article as a side by side learning material, i have to say iam very happy to see you update and bring those materials to your lectures now, they really made everything so much clearer also with the small but really good optimization with the constant values.

This saved me alot of time before i started trying to optimize it myself!

Overall i would rate this as a perfect starting point for anyone trying to learn computer graphics from scratch, even before doing any graphics programming using the GPU.

Thank you!"
26 Apr 2023
Jakub Komorowski
Senior Android Developer @ Opera
"If my university courses in cs were half as good as this course then the world would be a much better place. Hearty recommend!"
15 Apr 2023

Other similar courses

C++ 2D Game Engine Development

30 hours
  • Learn to make a simple 2D game engine using modern C++, SDL, ECS, and Lua.
raycasting texture c

Raycasting Engine Programming with C

18 hours
  • Write a raycasting engine with textures and sprites using the C programming language.

Game Physics Engine Programming

35 hours
  • Learn how to create a 2D rigid-body game physics engine from scratch with C++.