3D Computer graphics
From derivatives to rendering: vectors, normals, surfaces, lighting and the integral that gives each pixel its colour.
- 01
Functions
A rule that assigns to each input of a set exactly one output in a set . Calculus studies how outputs change when inputs change; computing is, quite literally, evaluating functions.
- 02
Derivative
is the instantaneous rate of change of at : the slope of the tangent line to the graph, defined as the limit of slopes of secant lines.
- 03
Vectors
Lists of numbers that can be added and scaled. Geometrically, arrows with a length and a direction; computationally, arrays.
- 04
Dot product
. It measures how much two vectors point the same way, and it is the single most executed operation in machine learning.
- 05
Partial derivatives
: the derivative with respect to one variable, holding the others fixed. Each answers "how sensitive is the output to this input?" — for a neural network, to this weight.
- 06
Gradient
: the vector of all partial derivatives. It points in the direction of steepest ascent, its length is that steepest slope, and it is perpendicular to the level sets. Walk against it and you go downhill fastest.
- 07
Surfaces and level sets
Three ways to describe a surface: a graph , a level set (implicit), or a parametrization . Contour maps of loss functions and the isosurfaces of medical imaging are level sets.
- 08
Surface normals
The unit vector perpendicular to a surface at a point. For an implicit surface it is ; for a parametric one , the normalized cross product . Every lighting computation starts from it.
- 09
Lighting and shading
Computing the colour of a surface point from the light, the normal and the viewer. Lambertian diffuse light is ; specular highlights use . Values are interpolated across triangles.
- 10
Bézier curves and splines
Polynomial curves controlled by a few points, glued with continuity conditions on derivatives (: same tangent, : same curvature). Fonts, SVG paths, CAD surfaces and animation curves are built from them.
- 11
Vector fields
A vector attached to every point: the wind, the flow of water, a magnetic field, the force of gravity. Integral curves (streamlines) follow the arrows.
- 12
Multiple integrals and change of variables
Integrals over regions of : volumes, masses, probabilities of random vectors. Computed as iterated integrals (Fubini) and transformed with the Jacobian determinant: .
- 13
Ray tracing
Follow rays of light from the camera into the scene: solve for intersections (roots of equations), reflect and refract using the normal, and recurse. Real-time ray tracing is now in consumer GPUs.
- 14
The rendering equation
Kajiya (1986): the light leaving a point equals the light it emits plus the integral, over all incoming directions, of incoming light times the material's reflectance times a cosine. An integral equation solved by Monte Carlo path tracing — the method behind modern film rendering.