Free module
Computer graphics from scratch
Learn computer graphics hands on: pixels, lines, colour blending, matrix transforms, filled triangles, ray tracing and shading in Python.
The lessons
Each lesson is free to read in full. Create a free account to run its commands in a live lab and to sit its quizzes and tasks.
1 · Container lab
Pixels, coordinates and drawing a line
I can place pixels on a grid with x and y coordinates and draw a straight line by stepping.
Read the lesson2 · Container lab
Colour, RGB and alpha blending
I can mix colours as numbers and blend one colour over another with alpha transparency.
Read the lesson3 · Container lab
Move, scale and rotate with matrices
I can move, scale and rotate a shape by multiplying its points by a matrix.
Read the lesson4 · Container lab
Filling a triangle with edge tests
I can decide which pixels are inside a triangle with edge tests and find a point's barycentric weights.
Read the lesson5 · Container lab
Where a ray hits a sphere
I can work out whether a ray hits a sphere and how far along the ray the nearest hit is.
Read the lesson6 · Container lab
Diffuse light and shading
I can work out the diffuse brightness of a surface from its normal and the direction to the light.
Read the lesson
Worked in a real lab
Every lesson of this module is worked in a lab started for you alone. The labs it uses:
Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.