The purpose of this course
A rendered image can look convincing while leaving its maker unable to explain why a particular surface was visible, why a shadow began where it did or how much work the computer performed to produce one pixel. That is not sufficient. In these lessons we construct the camera, intersections, light transport and sampling ourselves. Canvas will display the pixels, but it will not decide their values for us. By the end, every colour in the scene has an inspectable route back through a ray, a hit and a bounded calculation.
The Vulkan half then preserves those questions while changing where and how they are executed. Resources, descriptors, commands, synchronisation, acceleration structures and shader stages are introduced as explicit responsibilities. Hardware traversal may answer a geometric query; it does not decide what the query meant.
Static Carnival
Graphics Programming
Twenty-eight lessons: construct ray tracing by hand, then implement the same contracts through Vulkan.
Lessons 01-03
Rays and the camera
Begin with the raster, construct the ray and give every pixel a camera direction.
A Pixel Is a Question
Begin with the image itself and ask what one pixel is expected to know.
Open lesson → PART I · LESSON 02Vectors, Points and Rays
Construct the small collection of vector operations on which every later image depends.
Open lesson → PART I · LESSON 03The Pinhole Camera
Give every pixel a direction and turn a rectangular grid into a view of three-dimensional space.
Open lesson →Lessons 04-06
Hits and surfaces
Solve intersections, retain the nearest answer and describe the surface that was found.
Meeting a Sphere
Solve the first visibility equation and produce a shape without asking the canvas to draw one.
Open lesson → PART I · LESSON 05The Closest Visible Surface
Add several objects and make a deliberate decision about which result a pixel is permitted to keep.
Open lesson → PART I · LESSON 06Normals and Surface Materials
Separate the fact that a ray hit something from the information required to shade that surface.
Open lesson →Lessons 07-10
Light and geometry
Illuminate the hit, test visibility and extend the scene from spheres to planes and triangles.
Light Is Another Direction
Compute local illumination from the directions that meet at a surface point.
Open lesson → PART I · LESSON 08Shadows and the Problem of Zero
Send a second ray towards the light and handle the numerical boundary at the surface that created it.
Open lesson → PART I · LESSON 09Planes and a Grounded Scene
Introduce a second geometric primitive without changing the contract used by the rest of the renderer.
Open lesson → PART I · LESSON 10Triangles and Barycentric Coordinates
Intersect the primitive from which general meshes are assembled and retain enough information to interpolate it.
Open lesson →Lessons 11-14
Secondary rays and the complete scene
Add reflection, transmission and sampling before measuring the completed renderer.
Reflection and Recursive Rays
Let one successful intersection create another ray and place a strict limit on the resulting computation.
Open lesson → PART I · LESSON 12Refraction, Fresnel and Glass
Transmit a ray across a boundary while keeping its direction, medium and possible reflection under control.
Open lesson → PART I · LESSON 13Sampling the Pixel
Replace the convenient centre of a pixel with several measured positions and explain what the extra work buys.
Open lesson → PART I · LESSON 14A Complete Scene and the Cost of Seeing It
Assemble the renderer, measure the questions it asks and prepare the model that the Vulkan half will implement.
Open lesson →Lessons 15-18
Vulkan foundations
Create the device, resources, pipeline and synchronised dispatch that can own a shader-written image.
Vulkan Makes Ownership Explicit
Create the API, device and queue relationships that will own every later resource and command.
Open lesson → PART II · LESSON 16An Image Is Not Its Memory
Create the storage image, obtain its requirements and bind memory before asking a shader to write a pixel.
Open lesson → PART II · LESSON 17Descriptors Give the Shader Its Resources
Make the storage image visible to a compute shader through one inspectable descriptor and pipeline layout.
Open lesson → PART II · LESSON 18Record, Dispatch, Synchronise, Present
Turn a pipeline and its resources into ordered device work whose image writes are made visible before presentation.
Open lesson →Lessons 19-21
The manual tracer in compute
Transfer camera rays, sphere intersections and closest-hit traversal into independent compute invocations.
The Camera Becomes Shader Input
Transfer the Part I camera basis into shader-visible data and reconstruct one primary direction per invocation.
Open lesson → PART II · LESSON 20Move the Sphere Equation into Compute
Run the known ray-sphere equation independently for many pixels without changing its roots or accepted interval.
Open lesson → PART II · LESSON 21Scene Buffers and the Closest Hit
Place several sphere records in shader storage and retain the smallest valid intersection independently of record order.
Open lesson →Lessons 22-26
Completing the compute renderer
Add materials, light, shadows, triangles, secondary-ray state and sample accumulation without hiding their contracts.
Materials and Light Remain Separate
Carry hit records and material indices into local lighting without allowing resource layout to merge their responsibilities.
Open lesson → PART II · LESSON 23A Shadow Query Is Still Bounded
Implement any-hit visibility in the compute shader and preserve the interval from surface to light.
Open lesson → PART II · LESSON 24Triangles Need a Buffer Contract
Store vertices and indices with an explicit shader layout before applying the familiar triangle intersection test.
Open lesson → PART II · LESSON 25Secondary Rays Need Bounded State
Replace recursive control flow with an explicit per-invocation path loop, throughput and termination rule.
Open lesson → PART II · LESSON 26Accumulate Samples Without Losing the Average
Keep linear sample sums in a floating-point image and reset them whenever the represented scene changes.
Open lesson →Lessons 27-28
Hardware traversal and the complete renderer
Build acceleration structures, introduce ray queries and the ray-tracing pipeline, then compare all three execution routes.
Build BLAS and TLAS Before Asking Hardware
Describe triangle geometry and instances to Vulkan, build their acceleration structures and query them from compute.
Open lesson → PART II · LESSON 28The Ray Tracing Pipeline and the Complete Renderer
Move traversal into the ray-tracing pipeline, construct its shader binding table and audit what still belongs to the renderer.
Open lesson →