all lessons / computer_graphics 15 lessons · ~9h read

Computer Graphics, from first principles从第一性原理出发

A linearized tour of the forward problem: given a described virtual world — geometry, materials, lights, a camera — compute the image a sensor there would measure. This is the exact inverse of the Computer Vision track, and the whole field turns out to be one equation pursued under a budget. 一次线性化的旅程,讲的是正向问题:给定一个被描述出来的虚拟世界——几何、材质、光源、一台相机——去计算放在那里的传感器会测到怎样的图像。这正是《计算机视觉》那门课的逆问题;而整个领域,最终都归结为“在预算约束下逼近同一个方程”。

Who this is for适合谁读

You can code and you know a little linear algebra, but graphics feels like a bag of tricks: matrices, shaders, ray tracing, PBR, GPUs. This track puts those on one line so each lesson answers why the next one has to exist. Use the EN / 中文 switch in the top bar to read in either language; your choice is remembered across lessons.

你会写代码、也懂一点线性代数,但图形学看起来像一袋互不相干的技巧:矩阵、着色器、光线追踪、PBR、GPU。这门课把它们排在一条线上,让每一课都回答“为什么下一课非存在不可”。用顶栏的 EN / 中文 开关可切换语言;你的选择会在各课之间被记住。

The first-principles frame第一性原理框架

A renderer is a function from a scene to an image. The image is not arbitrary: it is what a virtual camera would measure if that scene were real and lit. So every graphics question reduces to four things, and the rest of the track just fills them in.

渲染器是一个从场景图像的函数。这张图像并不是随便画出来的:它是——如果这个场景真的存在、真的被点亮——一台虚拟相机会测到的东西。于是所有图形学问题都归结为四件事,整门课不过是把它们逐一填满。

Scene
Geometry, materials (BRDFs), lights, a camera几何、材质(BRDF)、光源、一台相机
Transport
How radiance flows source → surfaces → sensor辐射亮度如何“光源 → 表面 → 传感器”地流动
Visibility
Which surface is seen along a ray / at a pixel沿一条光线 / 在一个像素上,看到的是哪个表面
Budget
Compute / latency / authoring cost that picks the approximation决定“用哪种近似”的算力 / 延迟 / 制作成本

Why this order为什么是这个顺序

The order starts with the measurement, not with a GPU API. We first pin down what an image even is and the two ways to answer "what is visible" (rasterization vs ray tracing). Then we need the math to place things in space (transforms), and something to place (geometry). That gives the real-time path — turn triangles into pixels, interpolate, and fight aliasing. Only then do we earn the physics of light: the rendering equation, how surfaces respond (shading, PBR, materials), the correct global solution (ray and path tracing), and the real-time approximation of it. Motion, the color pipeline at the very end, and the GPU-as-a-system close the loop.

这个顺序从测量开始,而不是从某个 GPU API 开始。我们先弄清“图像到底是什么”,以及回答“什么是可见的”的两条路(光栅化 vs 光线追踪)。接着需要把物体摆进空间的数学(变换),以及可摆的东西(几何)。这就给出了实时路径——把三角形变成像素、做插值、和走样作斗争。到这一步,我们才有资格谈光的物理:渲染方程、表面如何回应光(着色、PBR、材质)、正确的全局解(光线追踪与路径追踪)及其实时近似。最后是运动、末端的色彩管线、以及“作为一套系统的 GPU”,把整条线收口。

StageLessonsWhat you should be able to do
Foundations01–03State rendering as the forward problem, move points through the transform chain, and choose a geometry representation.
Rasterization04–06Turn triangles into shaded, textured, anti-aliased fragments and explain the z-buffer.
Light & appearance07–09Write the rendering equation, evaluate a physically-based BRDF, and author materials that stay consistent across lights.
Global illumination10–12Trace rays through an accelerated scene, path-trace the equation with Monte Carlo, and fake it in real time.
Motion, color & systems13–15Animate, tone-map linear HDR to a display, and reason about a GPU frame budget and where graphics is heading.
阶段课次你应当能做到
基础01–03把渲染表述为正向问题、让点走完整条变换链、并为形状选一种几何表示。
光栅化04–06把三角形变成经过着色、贴图、抗锯齿的片元,并讲清深度缓冲。
光与外观07–09写出渲染方程、求值一个基于物理的 BRDF,并制作在不同光照下都一致的材质。
全局光照10–12在加速结构里追踪光线、用蒙特卡洛路径追踪求解方程、并在实时中把它“伪造”出来。
运动、色彩与系统13–15做动画、把线性 HDR 色调映射到显示器,并推理 GPU 的一帧预算与图形学的走向。

The lessons课程目录

01
What is rendering? The forward problem & two visibility strategies什么是渲染?正向问题与两种可见性策略
Rendering as the inverse of vision; the virtual pinhole camera; the image as samples of incoming light; the rendering equation stated as the north star; and the raster-vs-ray-tracing fork — the same visibility question with the loops transposed.渲染是视觉的逆问题;虚拟针孔相机;图像即对入射光的采样;把渲染方程立为“北极星”;以及光栅化 vs 光线追踪的分岔——同一个可见性问题,只是把循环转置了。
02
Transforms & spaces — homogeneous coordinates变换与空间——齐次坐标
Points vs vectors, why homogeneous coordinates unify translation with rotation/scale as one 4×4 matrix, composition and order, the model→world→view→clip→NDC→screen chain, and why perspective needs the w-divide.点与向量的区别;齐次坐标为何能把平移与旋转/缩放统一成一个 4×4 矩阵;矩阵复合与顺序;model→world→view→clip→NDC→screen 变换链;以及透视为何需要“除以 w”。
03
Geometry — meshes, curves & implicit surfaces几何——网格、曲线与隐式曲面
Why the triangle is graphics' atom; the mesh (vertices, normals, indices, winding); smooth surfaces from Bézier curves, splines and subdivision; implicit surfaces and SDFs as the ray-tracer's favourite; and tessellation.为什么三角形是图形学的“原子”;网格(顶点、法线、索引、绕序);由 Bézier 曲线、样条与细分得到的光滑曲面;隐式曲面与 SDF(光线追踪的最爱);以及镶嵌细分。
04
Rasterization — triangles to fragments & the z-buffer光栅化——三角形到片元与深度缓冲
The edge-function / half-plane test, barycentric coverage, the top-left rule, and the depth buffer as the visibility solution; why the painter's algorithm fails; back-face culling and clipping.边函数 / 半平面测试、重心坐标覆盖、左上填充规则,以及作为可见性解法的深度缓冲;画家算法为何失败;背面剔除与裁剪。
05
Interpolation & texture mapping插值与纹理映射
Barycentric interpolation of vertex attributes, the perspective-correct fix (interpolate over w), UV mapping, texture minification, and mipmaps + bilinear/trilinear/anisotropic filtering as the texture anti-alias.顶点属性的重心插值、透视校正修正(在 1/w 空间插值)、UV 映射、纹理缩小问题,以及作为纹理抗锯齿的 mipmap 与双线性/三线性/各向异性过滤。
06
Sampling & anti-aliasing采样与抗锯齿
The pixel is an area, not a point; rendering as sampling a signal with infinite frequencies at edges; jaggies and moiré as aliasing; SSAA, MSAA, post-AA (FXAA) and temporal AA with jitter.像素是一块面积、而非一个点;渲染即对在边缘处含无限高频的信号采样;锯齿与摩尔纹就是走样;SSAA、MSAA、后处理抗锯齿(FXAA)与带抖动的时域抗锯齿(TAA)。
07
Light & the rendering equation光与渲染方程
Radiometry done carefully — radiance, irradiance, solid angle; the BRDF and its laws (positivity, reciprocity, energy conservation); the hemisphere reflectance integral; and the full recursive rendering equation that lessons 08–12 approximate.认真讲辐射度量学——辐射亮度、辐照度、立体角;BRDF 及其定律(非负、互易、能量守恒);半球反射积分;以及第 08–12 课都在近似的、带递归项的完整渲染方程。
08
Local shading & physically-based reflectance局部着色与基于物理的反射模型
Approximating the integral with point lights and one BRDF evaluation: Lambert diffuse, empirical Phong/Blinn-Phong, then physically-based microfacet models — Cook-Torrance, GGX, Fresnel-Schlick — and the metalness-roughness workflow.用点光源 + 单次 BRDF 求值来近似积分:Lambert 漫反射、经验性的 Phong/Blinn-Phong,再到基于物理的微表面模型——Cook-Torrance、GGX、Fresnel-Schlick——以及金属度/粗糙度工作流。
09
Materials & texturing in depth材质与纹理进阶
The PBR map set (base color, normal, roughness, metallic, AO, height, emissive); normal mapping and tangent space; parallax and displacement; procedural texturing with value/Perlin/simplex noise; and getting sRGB-vs-linear right.PBR 贴图集合(基础色、法线、粗糙度、金属度、AO、高度、自发光);法线贴图与切线空间;视差与位移;用 value/Perlin/simplex 噪声做程序化纹理;以及正确处理 sRGB 与线性空间。
10
Ray tracing & acceleration structures光线追踪与加速结构
Ray generation, ray-triangle (Möller-Trumbore) and ray-sphere intersection, the Whitted recursive ray tracer (reflection, refraction, hard shadows), and the BVH that turns O(N) per ray into O(log N).光线生成、光线-三角形(Möller-Trumbore)与光线-球相交、Whitted 递归光线追踪器(反射、折射、硬阴影),以及把每条光线的 O(N) 降到 O(log N) 的 BVH(层次包围盒)。
11
Monte Carlo path tracing蒙特卡洛路径追踪
The rendering equation as a high-dimensional integral, Monte Carlo estimation and why it is unbiased, the recursive path-tracing loop, importance sampling and Russian roulette, variance as noise falling like 1/√N, and denoising.把渲染方程看作高维积分、蒙特卡洛估计及其无偏性、递归路径追踪循环、重要性采样与俄罗斯轮盘赌、作为噪声的方差以 1/√N 下降,以及去噪。
12
Real-time global illumination实时全局光照
Why a real-time frame can't path-trace; shadow maps (bias, PCF, peter-panning) and SSAO; precomputed GI — radiosity, lightmaps, irradiance probes and spherical harmonics; screen-space reflections; and the hardware-RT + ML shift.实时帧为何无法路径追踪;阴影贴图(偏移、PCF、彼得潘现象)与 SSAO;预计算 GI——辐射度、光照贴图、辐照度探针与球谐;屏幕空间反射;以及硬件光追 + ML 带来的转变。
13
Animation & motion动画与运动
Time as a dimension; keyframes and interpolation curves (easing, Catmull-Rom); quaternions and slerp for rotation (and why not Euler angles); skeletal animation and linear-blend skinning; particles and simple physics.把时间作为一个维度;关键帧与插值曲线(缓动、Catmull-Rom);用四元数与 slerp 做旋转插值(以及为何不用欧拉角);骨骼动画与线性混合蒙皮;粒子与简单物理。
14
Color, HDR & tone mapping色彩、HDR 与色调映射
Why we render in linear HDR, radiance vs display values, exposure, tone-mapping operators (Reinhard, filmic/ACES), the final gamma/sRGB encode, color spaces and gamuts (Rec.709/P3), and bloom.为何在线性 HDR 空间渲染、辐射亮度与显示值的区别、曝光、色调映射算子(Reinhard、filmic/ACES)、最终的 gamma/sRGB 编码、色彩空间与色域(Rec.709/P3),以及泛光(bloom)。
15
The real-time frame, the GPU & where graphics is going实时帧、GPU 与图形学的未来
The modern GPU (SIMT, warps, the programmable stages); forward vs deferred shading; how a game frame is assembled under a millisecond budget; culling/LOD/instancing; and the convergence with ML — neural rendering, NeRF and Gaussian splatting, and differentiable rendering.现代 GPU(SIMT、warp、可编程管线阶段);前向 vs 延迟着色;如何在毫秒级预算内拼出一帧游戏画面;剔除/LOD/实例化;以及与 ML 的融合——神经渲染、NeRF 与高斯泼溅、可微渲染。

How to use this如何使用这门课

  1. Read it linearly once. Path tracing assumes the rendering equation. The rendering equation assumes radiometry. Shading assumes visibility. Visibility assumes the transform chain. Skipping breaks the chain. 先按顺序完整读一遍。路径追踪以渲染方程为前提;渲染方程以辐射度量学为前提;着色以可见性为前提;可见性以变换链为前提。跳读会把这条链打断。
  2. Always ask "which term of the rendering equation is this?" Every technique — a shadow map, a mipmap, a BRDF, a probe — is an approximation of one piece of that one integral, chosen to fit a budget. 时刻自问“这是渲染方程的哪一项?”每一种技术——阴影贴图、mipmap、BRDF、探针——都是那一个积分中某一块的近似,是为了塞进某个预算而选出来的。
  3. Play with every widget. Aliasing, perspective-correct interpolation, importance sampling, and tone mapping are far easier to feel than to read. Each lesson ships exactly one. 把每个交互小控件都玩一遍。走样、透视校正插值、重要性采样、色调映射——这些用手感受远比读文字容易。每一课都恰好配一个。
  4. Watch the linear-vs-encoded trap. Half the "why does it look wrong" bugs in graphics are a value that was in the wrong color space. Lesson 14 makes the rule explicit, but it lurks from lesson 05 onward. 盯紧“线性 vs 编码”这个坑。图形学里一半的“为什么看起来不对”都是某个值待在了错误的色彩空间里。第 14 课会把规则讲透,但它从第 05 课起就潜伏着。
Companion material配套材料

Graphics is the forward map; Computer Vision and 3D Vision are the inverse — recovering the scene from images. They meet in lesson 15's neural rendering (NeRF, Gaussian splatting are literally differentiable renderers). Reach for GPU Kernels when the question turns from "what image" to "how many milliseconds," and for Math if the linear algebra in lesson 02 or the integrals in lesson 07/11 feel shaky.

图形学是正向映射;《计算机视觉》《3D 视觉》是它的逆——从图像还原场景。二者在第 15 课的神经渲染处相遇(NeRF、高斯泼溅本质上就是可微渲染器)。当问题从“画什么图像”转向“要几毫秒”时,去看《GPU Kernels》;若第 02 课的线性代数、或第 07/11 课的积分让你发怵,去看《数学》