This course includes:

(updated Jan 2021)

  • 35 hours of on-demand video

  • Downloadable resources and exercises

  • Full lifetime access

  • Access on mobile and desktop

  • 14-day money back guarantee

  • Certificate of completion

  • Secure checkout through Credit Card or PayPal

Is this course for you?

Did you ever wonder how 3D engines render objects on the screen? This course is a complete immersion on how CPU-based 3D engines work. We will use the C language to develop a complete 3D engine from scratch, pixel by pixel, triangle per triangle, mesh by mesh. This is a basic course that requires no prior knowledge, but you will probably make the most of it if you know already the basics of programming.
Buy $39.99
Is this course for you?

Prerequisites

Before taking this course, you must have:

  • A basic understanding of programming fundamentals, such as variables, conditionals, loops, and functions.

  • Some familiarity with the command-line on either Linux, Windows, or macOS.

Watch Intro Video

Course Motivations & Learning Outcomes

Technologies we'll use and learn

We will learn how to represent and display 3D objects without any graphics API.

No OpenGL. No DirectX. No GPU... Just you, a C compiler, a smoking processor, lots of linear algebra, and an array of pixels willing to dance 90's style.

We'll use the C programming language and a library called SDL to gain access and poke the pixels of our display.

What you'll learn

Here are the topics you'll learn in this course

  • C programming language & SDL

  • Rasterization of lines and triangles

  • Render flat-shading and textured 3D meshes

  • Linear algebra and the mathematics of computer graphics

  • Load and render external OBJ files

  • Projection, light, shading, and camera

  • Texture mapping

  • Z-Buffer & 3D Clipping

  • Lifetime access

    Enroll now and get lifetime access to the course content

  • Access to discussion forum

    Discuss course topics and engage with other students using the discussion board

  • Money back guarantee

    We offer a 14-day money back guarantee for all our courses. No questions asked.

Focus on the fundamentals

We'll learn the theory, the mathematics, and the algorithms of 3D computer graphics using a limited software rendering approach. No OpenGL. No DirectX. No hardware acceleration.
Buy $39.99
Focus on the fundamentals

Project-based learning

We'll implement together a software rasterizer using the C programming language. The course contains several exercises, quizzes, and activities for you to consolidate your knowledge in each one of the topics.
Buy $39.99
Project-based learning

Course Content

  • 2
    Dependencies and Folder Structure
  • 3
    SDL Initialization and Color Buffer
    • Creating an SDL Window
    • Rendering an SDL Window
    • Declaring a Color Buffer
    • Allocating Memory and Freeing Resources
    • Checking for Errors in Memory Allocation
    • Quiz: Memory Allocation
    • The Operator Sizeof
    • SDL Texture
    • Fullscreen Window
    • Exercise: Drawing a Background Grid
    • Drawing a Background Grid
    • Background Color Patterns
    • Exercise: Drawing Rectangles
    • Creating a Function to Draw Rectangles
    • Quiz: Color Buffer
  • 4
    Multiple Header Files
    • Defining Header Files
    • Coding New Header Files
  • 5
    Vectors and Points
    • The Draw Pixel Function
    • Vectors
    • Declaring a Vector Type
    • Review of C Structs
    • Array of Points
    • Constant Array Size Declaration
  • 6
    Projecting Points
    • Orthographic Projection
    • Isometric Projection
    • Perspective Projection
    • Implementing the Perspective Divide
    • Coordinate System Handedness
  • 7
    Linear Transformations
    • Vector Transformations
    • Review of Sine Cosine and Tangent
    • Trigonometric Functions Quiz
    • Rotating Vectors
    • Vector Rotation Function
    • Proof of Angle Sine Addition
    • Exercise: Proving the Angle Cosine Addition
    • Proof of Angle Cosine Addition
  • 8
    Fixed Game Loop
    • Fixing our Game Loop Time Step
    • Using a Delay Function
    • Capped Framerate & Delta time
  • 9
    Triangles and Vertices
    • Triangles and Meshes
    • Vertices and Triangle Faces
    • Triangle Edges
  • 10
    Line Drawing
    • Line Equation
    • DDA Line Drawing Algorithm
    • Coding a Function to Draw Lines
  • 11
    Dynamic Arrays
    • Dynamic Arrays
    • Dynamic Mesh Vertices and Faces
    • Separation of Vertex and Faces
  • 12
    OBJ Files
    • OBJ Files
    • Exercise: Loading OBJ File Content
    • Loading OBJ File Content
    • OBJ Files as Quads or Triangles
  • 13
    Vector Operations
    • Back-face Culling Motivation
    • Back-face Culling in Games
    • Vector Magnitude
    • Vector Addition and Subtraction
    • Vector Scalar Multiplication and Division
    • Vector Cross Product
    • Finding the Normal Vector
    • Dot Product
    • Back-face Culling Algorithm
    • Back-face Culling Code
    • Vector Normalization
  • 14
    Triangle Rasterization
    • Triangle Fill
    • Flat-Bottom & Flat-Top Technique
    • Activity: Find Triangle Midpoint
    • Solution to the Triangle Midpoint
    • Coding the Triangle Midpoint Computation
    • Flat-Bottom Triangle Algorithm
    • Flat-Bottom Triangle Code
    • Flat-Top Triangle Algorithm
    • Flat-Top Triangle Code
    • Avoiding Division by Zero
    • Exercise: Selecting Different Render Modes
    • Different Rendering Options Solution
    • Compiler Error & Enum Declaration
    • Typedef for Color Values
    • Colored Triangle Faces
  • 15
    Sorting Faces by Depth
    • Painter's Algorithm
    • Exercise: Sorting Faces
    • Coding a Sorting Function
  • 16
    Matrices
    • Matrices Overview
    • Matrix Operations
    • Properties of Matrix Multiplication
    • Examples of Matrix Multiplication
    • Exercise: Matrix Multiplication
    • 2D Rotation Matrix
  • 17
    3D Matrix Transformations
    • 3D Matrix Transformations
    • 3D Scale Matrix
    • Matrix Typedef
    • Scale Matrix Code
    • 3D Translation Matrix
    • Translation Matrix Code
    • 3D Rotation Matrices
    • Rotation Matrix Code
    • The World Matrix
    • Order of Transformations
    • Translation is Not a Linear Transformation
  • 18
    Projection Matrix
    • Defining a Projection Matrix
    • Coding the Perspective Projection Matrix
    • Perspective Projection Matrix Review
    • Normalized Device Coordinates
    • Projection in OpenGL
    • Row-major and Column-major Orders
    • Order of Transformations for Row-major and Column-major
  • 19
    Light and Shading
    • Flat Shading
    • Coding Flat Shading & Light
    • A Note on Vector Normalization
    • Smooth Shading Options
    • Inverted Vertical Screen Values
  • 20
    Texture Mapping
    • Texture Mapping
    • Representing Textures in Memory
    • Texture Typedef
    • Textured Triangles
    • Textured Flat-Bottom Triangle
    • Textured Flat-Top Triangle
    • Barycentric Coordinates
    • Barycentric Weights (α, β, γ)
    • Visualizing Textured Triangles
  • 21
    Perspective Correct Interpolation
  • 22
    Decoding PNG Files
    • Decoding PNG Files
    • Loading PNG File Content
    • Freeing PNG Textures
  • 23
    Textured OBJ Files
    • Loading OBJ Texture Attributes
    • Preventing Texture Buffer Overflow
    • Rasterization Rules
    • Visualizing Textured OBJ Models
  • 24
    Z-Buffer
    • Z-Buffer
    • Z-Buffer Code
    • Exercise: Z-Buffer for Filled Triangles
    • Implementing a Z-Buffer for Filled Triangles
    • A Discussion on Dynamic Memory Allocation
  • 25
    Camera
    • Camera Space
    • Look At Camera Model
    • Look At Transformations
    • The LookAt Function
    • Coding the LookAt Function
    • So, What Actually Gets Transformed?
    • Delta Time Factor
    • A Simple FPS Camera Movement
    • Coding a Simple FPS Camera Movement
  • 26
    Clipping
    • Frustum Clipping
    • Planes
    • Exercise: Right Frustum Plane Point & Normal
    • Defining Frustum Planes Points & Normals
    • Initializing an Array of Frustum Planes
    • Defining Points Inside and Outside Planes
    • Intersection Between Line & Plane
    • Clipping a Polygon Against a Plane
    • Polygon Typedef
    • A Function to Clip Polygon Against Planes
    • Coding the Function to Clip Polygons Against Planes
    • Converting Polygons Back Into Triangles
    • Visualizing Clipped Triangles
    • Horizontal & Vertical FOV Angles
    • Clipping Texture UV Coordinates
    • Clipping in Image Space
    • Deciding What Not to Render
  • 27
    Code Polishing & Refactoring
    • Working with Static Variables
    • Refactoring SDL Globals
    • Simulating Low-Resolution Displays
    • Refactoring Light Globals
    • Exercise: Camera Pitch Rotation
    • Implementing the Camera Pitch Rotation
  • 28
    Multiple Meshes
    • Declaring Multiple Meshes
    • Implementing Multiple Meshes
    • Implementing Multiple Textures
  • 29
    Conclusion and Next Steps
    • Finishing our Implementation
    • Handedness and Orientation
    • Dedicated Graphics Cards
    • Modern Graphics APIs & Shaders
    • Modern 3D Hardware Techniques
    • Next Steps
    • Copyright & Content Distribution
    • Similar Courses

FAQ

  • Will this course work for any operating system?

    The code we'll create will work for Linux, macOS, Windows, and even RaspberryPi.

  • What if I don't know anything about the C programming language?

    Not a problem. Many students come from different languages (C++, Java, Python, JavaScript, Swift, etc.). A basic understanding of coding in any language is enough for you to follow along. We'll learn the details of the C language together.

  • What if I have any issues or questions?

    Each lecture has its own discussion board, where you can interact and ask other students for help.

Instructor

  • Gustavo Pezzi

    Senior Lecturer

    Gustavo Pezzi

    Gustavo teaches computer science and mathematics at BPP University, London. He studies how teaching game programming can help enhance awareness and understanding of basic mathematics and physics. He is also a professional software engineer with more than 10 years of experience, with an industry background in 3D systems, games, systems, databases, and data analysis. His academic path includes institutions such as Pittsburg State University, City University of London, and University of Oxford.