GAMES101

2022-02-11 15:39:29 浏览数 (1)

Lecture1: intro

计算机图形学

使用计算机synthesize(合成) manipulate(操作) 可视化信息

why study computer graphics?

  • Application
    • video games 电子游戏
    • animations 动画
    • visualization 可视化
    • virtual reality
    • augmented reality 增强现实
    • digital illustration 数码插画
    • simulation 模拟
    • graphical user interfaces 图形用户界面
    • typography 排版
  • technical chanllenges

Course topics

  • Rasterization 光栅化
    • project geometry primitives (3D triangles / polygons) onto the screen 将几何图形(3D三角形 / 多边形)投射到屏幕上
    • 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

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}cdotvec{b} = |vec{a}|cdot|vec{b}|costheta 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 ​
  • Direction determined by right-hand rule
  • 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

  • (AB)^{T} = B^{T}A^{T}
  • AA^{-1} = A^{-1}A = I
  • (AB)^{-1} = B^{-1}A^{-1}

In Graphics, pervasively used to represent transformations

  • translation, rotation,shear剪切,scale缩放

Lecture 3: Transformation

why study transformation

  • modeling
    • translation
    • rotation
    • scaling
  • viewing
    • 3D (projection)
    • 2D (projection)

2D transformations:

  • representing transformations using matrices
  • rotation R_{theta} = begin{bmatrix} costheta & -sintheta \ sintheta & costheta end{bmatrix} R_{-theta} = begin{bmatrix} costheta & sintheta \ -sintheta & costheta end{bmatrix} = R_{theta}^{T} = R_{theta}^{-1}(by quad definition)
  • scale matrix begin{bmatrix} x^{‘} \ y^{‘} end{bmatrix} = begin{bmatrix} s_{x} & 0 \ 0 & s_{y} end{bmatrix}begin{bmatrix} x \ y end{bmatrix}
  • reflection matrix 反射(镜像)矩阵 begin{bmatrix} x^{‘} \ y^{‘} end{bmatrix} = begin{bmatrix} -1 & 0 \ 0 & 1end{bmatrix}begin{bmatrix} x \ y end{bmatrix}
  • shear matrix ​ begin{bmatrix} x^{‘} \ y^{‘} end{bmatrix} = begin{bmatrix} -1 & a \ 0 & 1end{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}
  • Affine transformation 仿射变换 仿射变换:先线性变换再加上一次平移 begin{bmatrix} x^{‘} \ y^{‘} \ 1 end{bmatrix} = begin{bmatrix} a & b & t_{x}\ c & d & t_{y} \ 0 & 0 & 1 end{bmatrix} begin{bmatrix} x \ y \ 1 end{bmatrix} S(s_{x}, s_{y}) = begin{bmatrix} s_{x} & 0 & 0 \ 0 & s_{y} & 0 \ 0 & 0 & 1 end{bmatrix} R(alpha) = begin{bmatrix} cosalpha & -sinalpha & 0 \ sinalpha & cosalpha & 0 \ 0 & 0 & 1 end{bmatrix} T(t_{x}, t_{y}) = begin{bmatrix} 1 & 0 & t_{x} \ 0 & 1 & t_{y} \ 0 & 0 & 1 end{bmatrix}
  • transform ordering matters
    • matrix multiplication is not commutative 可交换的

composing transforms

  • 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}
  • 三维空间中的齐次变换,最后一行和二维变换类似,是0 0 0 1,平移还是在矩阵最后一列
  • 对于仿射变换,是先应用线性变换,再加上平移
  • what is order? linear transform first or translation first? scale S(s_{x}, s_{y},s_{z}) = begin{bmatrix} s_{x} & 0 & 0 & 0\ 0 & s_{y} & 0 & 0\0 & 0 & s_{z} & 0 \ 0 & 0 & 0 & 1 end{bmatrix} T(t_{x}, t_{y}, t_{z}) = begin{bmatrix} 1 & 0 & 0 & t_{x}\ 0 & 1 & 0 & t_{y} \0 & 0 & 1 & t_{z} \ 0 & 0 & 0 & 1 end{bmatrix} R_{xyz}(alpha, beta, gamma) = R_{x}(alpha)R_{y}(beta)R_{z}(gamma)

Viewing (观测) transformation

  • View (视图) / Camera transformation
    • Think about how to take a photo
      • Find a good place and arrange people (model transformation)
      • Find a good “angle” to put the camera (view transformation)
      • Cheese! (projection transformation)
        • 定义相机
        • 位置
        • 往哪看
        • 向上方向
        • 现实中是移动相机,变换景物
        • 图形学中,相机不动,永远在原点
        • 经过变换,把相机的位置移动到原点,同时保持看到的景物不变
  • 这个从“歪”的坐标轴旋转回正的坐标轴,不太好写。 但是这个变换的逆过程,即:从正的坐标轴旋转到“歪”的坐标轴,是好写的, 于是我们先写从“正”坐标轴变换到“歪”坐标轴的变换矩阵,再求其逆矩阵,就可以得到待求的变换矩阵。 又因为旋转矩阵是正交矩阵,所以他的逆矩阵就只需要转置一下就可以得到了! 注意,不但相机要做这个变换,其他物体也要做这个变换,因为我们想让相机看到的景物相对不变。 (以上部分个人认为非常巧妙和关键!)
  • Projection (投影) transformation 3D to 2D Orthographic (正交) projection 没有近大远小 平行投影 首先定义空间中一个立方体,将其translate,使其中心在原点,再scale成标准立方体(边长为2 再次提醒,注意

    0 人点赞