Computer Graphics (rasterisation, ray tracing, WebGPU)
Computer graphics from pixels to GPUs: transforms, rasterisation, clipping, shading, ray tracing, OpenGL and WebGL 2, WebGPU and three.js, with tested code.
31 lessons: 22 free with Pro answers and 9 with a free core.
Examples run with Node.js 24.21.0 and quickjs 0.32.0.
Who it is for
CS and IT students on university graphics courses and OpenGL labs or UGC NET Computer Science, web developers moving to WebGL 2, WebGPU and three.js, and game and creative-coding developers.
What you will be able to do
- Implement the classic raster algorithms (lines, circles, fills, clipping) exactly as UGC NET and university courses test them
- Build 2D and 3D transformation, camera and projection pipelines with correct conventions for WebGPU, glTF and three.js
- Write a software rasteriser with depth buffering, perspective-correct texturing and Phong shading
- Program the GPU with WebGPU and WGSL: buffers, bind groups, render targets, compute shaders and compatibility mode
- Program WebGL 2 with GLSL ES 3.00 and port the same programs to OpenGL 3.3 core and textbook OpenGL for university labs
- Render physically based materials with shadows, HDR and tone mapping
- Write ray tracers and path tracers with BVHs, importance sampling and progressive GPU accumulation
- Model curves, surfaces and meshes with Bézier, B-spline, NURBS, subdivision and signed distance fields
- Ship accessible three.js scenes that load glTF assets within a mobile performance budget
Revise and practise
- Practice: every exercise and quiz (58 exercises, 31 quizzes)
Modules and lessons
What the labels mean
- Free lesson, Pro answers
- the whole lesson is free; the model answers to its interview questions open with a pass
- Free core, Pro depth
- the core of the lesson is free; its in-depth parts open with a pass
- Pro
- opens with a Pro, Premium or Ultimate pass
Minutes are reading time: “9 of 25 min free” means 9 minutes of the lesson are free.
What a pass opens in this track
27 in-depth parts and 71 interview answers. The same pass opens every other track and every Pro tool.
- Module 1
Foundations: pixels, displays, colour and the pipeline
What a computer image is, how rasterisation and ray tracing decide what is visible, framebuffers and image files, and colour stored as sRGB values.
- How computer graphics makes images Free lesson, Pro answers: 20 minutes
- Framebuffers, displays and image files Free lesson, Pro answers: 20 minutes
- Colour, light and sRGB encoding Free lesson, Pro answers: 20 minutes
- Module 2
The maths toolkit: vectors, matrices and precision
Points and vectors, dot and cross products, matrices and homogeneous coordinates, and the floating-point limits that geometry code has to respect.
- Vectors, points, dot and cross products Free lesson, Pro answers: 20 minutes
- Matrices and homogeneous coordinates Free lesson, Pro answers: 20 minutes
- Floating point, precision and robust geometry Free lesson, Pro answers: 20 minutes
- Module 3
Classic raster algorithms: lines, circles and fills
DDA and Bresenham lines, midpoint circles and ellipses, and scanline, boundary and flood fills, traced pixel by pixel on small grids.
- Line drawing: DDA and Bresenham's algorithm Free lesson, Pro answers: 25 minutes
- Midpoint circle and ellipse algorithms Free lesson, Pro answers: 25 minutes
- Polygon fill: scanline, boundary and flood fill Free lesson, Pro answers: 30 minutes
- Module 4
2D transformations, viewing and clipping
Translation, rotation, scaling, reflection and shear as matrices, window-to-viewport mapping, and Cohen-Sutherland, Liang-Barsky and Sutherland-Hodgman clipping.
- 2D transformations and composite transforms Free lesson, Pro answers: 25 minutes
- Window-to-viewport mapping and coordinate systems Free lesson, Pro answers: 25 minutes
- Line clipping: Cohen-Sutherland and Liang-Barsky Free lesson, Pro answers: 25 minutes
- Polygon clipping: Sutherland-Hodgman and beyond Free lesson, Pro answers: 20 minutes
- Module 5
3D transformations, rotations, cameras and projection
3D transforms, Euler angles and gimbal lock, quaternions, scene graphs, view and projection matrices, and clipping in clip space.
- 3D transformations, Euler angles and gimbal lock Free lesson, Pro answers: 25 minutes
- Quaternions and rotation interpolation Free lesson, Pro answers: 25 minutes
- Scene graphs and hierarchical transforms Free lesson, Pro answers: 20 minutes
- Cameras, view matrices and projections Free lesson, Pro answers: 25 minutes
- Clipping in clip space and the viewport transform Free lesson, Pro answers: 20 minutes
- Module 6
Triangles, depth and visibility: a software rasteriser
Edge functions, barycentric and perspective-correct interpolation, depth buffers and z-fighting, and the hidden-surface methods that came before them.
- Rasterising triangles with edge functions Free lesson, Pro answers: 20 minutes
- Barycentrics and perspective-correct interpolation Free core, Pro depth: 9 of 25 minutes free
- Depth buffers, precision and z-fighting Free core, Pro depth: 9 of 25 minutes free
- Hidden-surface removal beyond the z-buffer Free core, Pro depth: 10 of 25 minutes free
- Module 7
Light, shading and transparency
Light sources, diffuse and specular reflection with Phong and Blinn-Phong, flat, Gouraud and Phong shading, and blending with alpha.
- Light sources and diffuse reflection Free lesson, Pro answers: 20 minutes
- Phong and Blinn-Phong reflection models Free core, Pro depth: 9 of 25 minutes free
- Flat, Gouraud and Phong shading Free core, Pro depth: 9 of 25 minutes free
- Transparency, blending and alpha compositing Free core, Pro depth: 9 of 25 minutes free
- Module 8
Textures, filtering and anti-aliasing
UV mapping, filtering with mipmaps and anisotropy, normal and environment maps, and the sampling theory behind anti-aliasing.
- Texture mapping and UV coordinates Free lesson, Pro answers: 20 minutes
- Filtering, mipmaps and anisotropic filtering Free core, Pro depth: 9 of 25 minutes free
- Normal, bump and environment mapping Free core, Pro depth: 9 of 25 minutes free
- Sampling theory and anti-aliasing Free core, Pro depth: 9 of 25 minutes free
- Module 9
GPU programming with WebGPU and WGSL
How GPUs run work, WebGPU's adapter, device and pipelines, WGSL, buffers and bind groups, render targets and readback, compute shaders and limits.
- How GPUs work: SIMT, memory and tiling Free lesson, Pro answers: 25 minutes
Related tools
Official documentation
- WebGPU (World Wide Web Consortium (W3C))
- WebGPU Shading Language (WGSL) (World Wide Web Consortium (W3C))
- WebGL 2.0 Specification (Khronos Group)
- glTF 2.0 Specification (Khronos Group)
- three.js documentation (three.js authors)
- HTML Living Standard: the canvas element (WHATWG)