Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Computer science fundamentals

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 to read 9 modules

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

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.

  1. 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.

    1. How computer graphics makes images Beginner Free lesson, Pro answers: 20 minutes
    2. Framebuffers, displays and image files Beginner Free lesson, Pro answers: 20 minutes
    3. Colour, light and sRGB encoding Beginner Free lesson, Pro answers: 20 minutes
  2. 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.

    1. Vectors, points, dot and cross products Beginner Free lesson, Pro answers: 20 minutes
    2. Matrices and homogeneous coordinates Intermediate Free lesson, Pro answers: 20 minutes
    3. Floating point, precision and robust geometry Intermediate Free lesson, Pro answers: 20 minutes
  3. 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.

    1. Line drawing: DDA and Bresenham's algorithm Beginner Free lesson, Pro answers: 25 minutes
    2. Midpoint circle and ellipse algorithms Beginner Free lesson, Pro answers: 25 minutes
    3. Polygon fill: scanline, boundary and flood fill Intermediate Free lesson, Pro answers: 30 minutes
  4. 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.

    1. 2D transformations and composite transforms Beginner Free lesson, Pro answers: 25 minutes
    2. Window-to-viewport mapping and coordinate systems Beginner Free lesson, Pro answers: 25 minutes
    3. Line clipping: Cohen-Sutherland and Liang-Barsky Intermediate Free lesson, Pro answers: 25 minutes
    4. Polygon clipping: Sutherland-Hodgman and beyond Intermediate Free lesson, Pro answers: 20 minutes
  5. 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.

    1. 3D transformations, Euler angles and gimbal lock Intermediate Free lesson, Pro answers: 25 minutes
    2. Quaternions and rotation interpolation Intermediate Free lesson, Pro answers: 25 minutes
    3. Scene graphs and hierarchical transforms Intermediate Free lesson, Pro answers: 20 minutes
    4. Cameras, view matrices and projections Intermediate Free lesson, Pro answers: 25 minutes
    5. Clipping in clip space and the viewport transform Advanced Free lesson, Pro answers: 20 minutes
  6. 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.

    1. Rasterising triangles with edge functions Intermediate Free lesson, Pro answers: 20 minutes
    2. Barycentrics and perspective-correct interpolation Intermediate Free core, Pro depth: 9 of 25 minutes free
    3. Depth buffers, precision and z-fighting Intermediate Free core, Pro depth: 9 of 25 minutes free
    4. Hidden-surface removal beyond the z-buffer Intermediate Free core, Pro depth: 10 of 25 minutes free
  7. 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.

    1. Light sources and diffuse reflection Beginner Free lesson, Pro answers: 20 minutes
    2. Phong and Blinn-Phong reflection models Intermediate Free core, Pro depth: 9 of 25 minutes free
    3. Flat, Gouraud and Phong shading Intermediate Free core, Pro depth: 9 of 25 minutes free
    4. Transparency, blending and alpha compositing Intermediate Free core, Pro depth: 9 of 25 minutes free
  8. 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.

    1. Texture mapping and UV coordinates Intermediate Free lesson, Pro answers: 20 minutes
    2. Filtering, mipmaps and anisotropic filtering Intermediate Free core, Pro depth: 9 of 25 minutes free
    3. Normal, bump and environment mapping Advanced Free core, Pro depth: 9 of 25 minutes free
    4. Sampling theory and anti-aliasing Intermediate Free core, Pro depth: 9 of 25 minutes free
  9. 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.

    1. How GPUs work: SIMT, memory and tiling Intermediate Free lesson, Pro answers: 25 minutes

Related tools

Official documentation

More in Computer science fundamentals

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.