break projected primitives into fragments (pixels)
将投影图元分解到片段(像素)
gold standard in video games (real-time applications)
curves and meshes 曲线和栅格
怎样represent geometry in CG
ray tracing 光线追踪
shoot rays from camera though each pixel
calculate intersection and shading 交叉点和阴影
continue to bounce the rays till they hit light sources
gold standard in animations / movies (offline离线 application)
animation simulation
key frame animation 关键帧动画
mass-spring system 弹簧振子系统
differences between cg and cv
No clear boundaries
image-20210913210044004
Lecture2: review of linear algebra
Graphics’ dependcies
basic mathematics
Linear algebra 线性代数
mostly dependent on linear algebra
vectors(dot products点乘,cross products叉乘
An operation like translating or rotating objects can be matrix-vector multiplication
matrices 矩阵(复数
calculus 微积分
statistics 统计
basic physics
Optics, 光学的
Mechanics 机械的
misc 杂项
Numerical analysis 数值分析
signal processing 信号处理
aesthetics 审美
vectors
noting: 只记了part
unit vector
单位向量,
用来代表方向
dot product in graphics \vec{a}\cdot\vec{b} = |\vec{a}|\cdot|\vec{b}|cos\theta Find angle between two vectors (e.g. cosine of angle between light source 光源 and surface表面) Finding projection of one vector on another measure how close two directions are decompose分解 a vector determine forward or backward
cross product in graphics
image-20210913220439863
Direction determined by right-hand rule
image-20210913220739158
Useful in constructing coordinate systems (later)
Determine left / right
Determine inside / outside
Orthonormal bases and coordinate frames 正交基底和坐标系
Critical issue is transforming between these systems/ bases
matrices
image-20210913223344462
(AB)^{T} = B^{T}A^{T}
AA^{-1} = A^{-1}A = I
(AB)^{-1} = B^{-1}A^{-1}
image-20210913223854494
In Graphics, pervasively used to represent transformations
shear matrix \begin{bmatrix} x^{‘} \\ y^{‘} \end{bmatrix} = \begin{bmatrix} -1 & a \\ 0 & 1\end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix}
Linear transforms 线性变换:可以用一个矩阵表示的变换 x’ = ax + by y’ = cx + dy \begin{bmatrix} x^{‘} \\ y^{‘} \end{bmatrix} = \begin{bmatrix} a & b \\ c & d \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix}
Homogeneous coordinates 齐次坐标
Why homogeneous coordinates for example: translation \begin{bmatrix} x^{‘} \\ y^{‘} \end{bmatrix} = \begin{bmatrix} a & b \\ c & d \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix} + \begin{bmatrix} t_{x} \\ t_{y} \end{bmatrix}
decomposing complex transforms translate center to origin rotate translate back which means T(c) · R(\alpha) · T(-c) 分解:变换可以分解,注意先后顺序是从右到左 2D变换矩阵(缩放,旋转,平移变换)
Lecture 4: Transformation Cont
3D transformations
3D point = (x,y,z,1)^T^
3D vector = (x,y,z,0)^T^
\begin{bmatrix} x^{‘} \\ y^{‘} \\ z_{‘} \\ 1 \end{bmatrix} = \begin{bmatrix} a & b & c & t_{x}\\ d & e & f & t_{y}\\g & h & i & t_{z} \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\z \\ 1 \end{bmatrix}
Projection (投影) transformation 3D to 2D Orthographic (正交) projection 没有近大远小 平行投影 首先定义空间中一个立方体,将其translate,使其中心在原点,再scale成标准立方体(边长为2 再次提醒,注意𝑧轴是近大远小 OpenGL等API是反过来的 Perspective (透视) projection 更像人眼看到的场景 Most common in Computer Graphics, art, visual system Further objects are smaller Parallel lines not parallel; converge to single point Recall: property of homogeneous coordinates (x, y, z, 1), (kx, ky, kz, k != 0), (xz, yz, z2, z != 0) all represent the same point (x, y, z) in 3D e.g. (1, 0, 0, 1) and (2, 0, 0, 2) both represent (1, 0, 0) how to do perspective projection 先将frustum远平面,挤压成和近平面一样大(从左图变成右图) 再做正交投影,投影到近平面 上述操作过程中几点假设: 1)近平面保持不变 2)z值保持不变,只是向内收缩 挤压这一步怎么做? 上图是从侧面观察frustum 用相似三角形知识可以得到新坐标的表达式,但是第三个分量目前还不知道(这里利用之前讲的那个性质: 齐次坐标,如果我们对点的坐标所有分量同时乘以k,他表示的还是原来那个点! 如何求解第三行 任何近平面上的点不会改变(也就是对于任意的(𝑥, 𝑦, 𝑛, 1),经过这个矩阵变换后,点的位置仍然不变) 任何远平面上的点,𝑧值不会改变 点(𝑥, 𝑦, 𝑧, 1)是可以通过矩阵变换得到(𝑛𝑥, 𝑛𝑦, 𝑢𝑛𝑘𝑛𝑤𝑜𝑛, 𝑧)向量的。 根据上文提到的性质(1),经过这个变换,点实际没有改变 而同时,(𝑥, 𝑦, 𝑧, 1)本身可以写成(𝑥, 𝑦, 𝑛, 1)(为什么把𝑧替换成𝑛?因为近平面的𝑧坐标就是都是𝑛,所以可以做这个替换。)然后同时乘以𝑛, 变成(𝑛𝑥, 𝑛𝑦, 𝑛 ଶ , 𝑛) 经过上面两个推导,可以看出,第三行前两个数一定是0 因为𝑛 ଶ这个分量和𝑥和𝑦都毫无关系,因此前两个数必定是0 这样,我们就解出了第三行前两个数,都是0 接下来求A和B 远平面上有一个特殊点,(0, 0, 𝑓)经过变换挤压仍然不变 所以(0, 0, 𝑓)经过变换仍然是(0, 0, 𝑓) 根据近平面我们得到An + B = n^{2},根据远平面的中心点我们得到
Lecture05: Rasterization 1(Triangles)
Finishing up Viewing
Viewport(视口) transformation
image-20211005190731847
上节课把透视投影转化成正交投影 这里引入另外一个概念 Field of View,表示你能看到的角度的范围 注意看上图中红色线的夹角,就是垂直可视角度,他越大,可视角度越大 同理还有水平可视角度