My mostly inaccurate explanations on the 3D rendering pipeline.

Scroll to the end for an illustrated example of some different texture type

Let's say, for the sake of the "educative" value of this document, that we are going to write our own 3D renderer that runs on the CPU. This is a very simplified version of the rendering pipeline, but it should give you a good idea of what is going on.

1. 3D Models

The first thing we need is a 3D model. A 3D model is a collection of vertices that define the shape of an object. Each vertex has a position in 3D space and can have other attributes like color, normal, texture coordinates, etc.

Feel free to skip these details

One simple file we could look at is a cube.obj file exported from Blender:

A simple cube rendered with EEVEE in Blender. It is lit by a single “Sun Light” or “Directional Light”

A simple cube rendered with EEVEE in Blender. It is lit by a single “Sun Light” or “Directional Light

# Blender 4.2.2 LTS
# www.blender.org
o Cube.001
v -1.000000 -1.000000 1.000000
v -1.000000 1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v -1.000000 1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v 1.000000 1.000000 1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -1.000000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -0.0000 -1.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vt 0.375000 0.000000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.625000 0.500000
vt 0.375000 0.500000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.125000 0.500000
vt 0.125000 0.750000
vt 0.875000 0.500000
vt 0.875000 0.750000
s 0
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 8/5/2 7/6/2
f 7/6/3 8/5/3 6/7/3 5/8/3
f 5/8/4 6/7/4 2/9/4 1/10/4
f 3/11/5 7/6/5 5/8/5 1/12/5
f 8/5/6 4/13/6 2/14/6 6/7/6

2. Drawing the vertices

The first step would be to draw the vertices. We will skip the explanation of the (somewhat) complicated phase of “projecting the 3D vertices’ positions onto a 2D plane (the computer’s screen)”.

Sidetrack :

*Basically, it works like this: we have a camera that is looking at the 3D scene. The camera has a position, a direction, and a field of view. The camera is projecting the 3D scene onto a 2D plane (the screen). The vertices are projected onto the screen using a projection matrix.

Well... Actually there is 3 matrices (Model, View, Projection) that are multiplied together to get the final transformation matrix. The vertices are multiplied by this matrix to get the final position on the screen.*

3. Drawing faces

Since most game engine end up splitting N-gons into triangles, here is a quick look at the cube.obj once triangulated.