本文使用 Zhihu On VSCode 创作并发布
注:本文部分内容源自于UDE课程 Computer Graphics(Prof. Dr. Jens Krüger),仅供本人自己学习与作为课程笔记使用。(所有引用都已标注原网址,见文章或附录。若存在版权侵犯,请联系本人删除侵权内容。)
Ps:若需要课程原ppt请联系我。再次声明,所有文档不可作为商业用途,仅供学习使用。谢谢!
1. 第一章 简介 Introduction
1.1 教授推荐的书(UDE 图书馆可以借阅到)
Foley, Van Dam, Feiner, Hughes ... Computer Graphics: Principles and Practice, Addison-Wesley
Watt & Watt Computer Graphics, Addison-Wesley
Glassner Principles of digital image synthesis, Morgan Kaufman
1.2 从几个方面简单了解一下CG
渲染(Rendering):是指在计算机上展示模型和场景。The display of models and scenes on a computer.
动画与仿真(Animation & Simulation):指在计算机上动态图像的生成和表示。The generation and representation of dynamic imagery on a computer.
Animation & Simulation 影像与计算机视觉(Imaging & Computer Vision):对图像的处理和从图像中提取特定对象的信息。The manipulation of images and the extraction of object specific information from images.
- Ps:在课程视频中教授提到了 CRV(Prof. Dr. Pauli) 这门课,这门课主要就是介绍这个方向的内容的。其实我已经通过了这门课的考试,但是等后期有时间了,我也会整理资料上传的。
建模(Modeling):几何形状在计算机上的有效表示和有效修改。The effective representation and efficient modification of geometric shape on a computer.
可视化(Visualization):在大规模多维和/或多模态数据集中可视化地表示信息内容的方法。Methods to visually represent the information content within large-scale multi-dimensional and/or multimodality data sets.
1.3 逼真的图像合成 Photorealistic image synthesis
- 图像合成算法,即渲染算法(Algorithms for image synthesis, i.e. rendering algorithms)
通过给定一个数字模型来生成这个模型所描述的真实图像。Given a digital model on the computer, what has to be done to generate a realistic image of this model.
一个足够逼真的图像与真实物体的照片我们通常没有办法将它们区分开了,下面的这张图片就是使用CG生成的。A realistic image is one that cannot be distinguished from a photograph of the real object.
1.4 图像合成的成分和先决条件 Ingredients and prerequisites for image synthesis
第一步 基础 fundamentals:
- 建模 Modeling
- 多边形对象 Polygonal objects
- 颜色 Color
- 光线交互 Light interaction
- 光照 Illumination
- 反射,折射 Reflection, Refraction
- 建模 Modeling
第二步 光线追踪 ray-tracing:
- 光线追踪 Ray-tracing
- 技巧 Technique
- 转换 Transformations
- 照明/阴影 Lighting/Shading
- 最优化 Optimization
- 取样 Sampling
- 光线追踪 Ray-tracing
第三步 图形APIs graphics APIs:
- 基于光栅化呈现 Rasterization based rendering
- 渲染管道 Rendering pipeline
- 投影变换 Projective transforms
- 光栅化 Rasterization
- 可编程性与GPUs Programmability and GPUs
2. 第二章 几何模型1 Geometric Models 1
2.1 对象的表示 Object representation
- 在计算机图形学中,我们经常在连续的对象上处理多边形近似。In computer graphics we often deal with polygonal approximations of continuous objects.
2.2 那么什么是多边形 What is a polygon?
它由点组成,通常在3d空间 ℝ3。 It consists of points, typically in 3D-space ℝ3.
- 一个点通过x、y、z坐标被表示出来;它被称为顶点。A point is represented by its x, y, z - coordinates; it is called a vertex.
点通过线段(边)连接。Points are connected via line segments (edges).
- 线段是根据其端点的顶点来指定的。Line segments are specified in terms of the vertices at their endpoints.
多边形是一个平面封闭连通的一系列线段的内部。A polygon is the interior of a closed planar connected series of line segments.
任意两条边不交叉,恰好两条边在每个顶点相交。The edges do not cross each other and exactly two edges meet at every vertex.
2.3 多边形网格 Polygon mesh
那么什么是多边形网格 What is a polygon mesh?
- 对象通常被认为是空心的。它们由一个由多边形(面)组成的封闭表面建模——边界表示或表面网格,即,对象建模为多面体。Objects are typically considered to be hollow. They are modelled by a closed surface composed of polygons (faces) – the boundary representation or surface mesh i.e., objects are modelled as polyhedra..
多边形网格的类型 Types of polygon meshes
- 三角形网格和四边形网格。Triangle meshes and quad meshes.
无效的网格 Invalid Meshes
带孔的三角剖分 holes
具有重叠面的三角剖分 overlapping face
带有T形顶点的三角剖分 T-Vertices
我们只考虑流形网格 Manifold meshes
- 这种网格,其中除边界边外,每条边都必须由恰好两个面共享。A mesh where every edge must be shared by exactly 2 faces, except the border edges.
我们只考虑可定向的曲面 Orientable surfaces
- 这样的曲面,法线可以一致地排列,例如全部指向外。Normals can be ordered consistently, e.g. pointing outwards.
Ps:不可定向的曲面典型的2个案例就是:莫比乌斯带 (Möbius strip) 与 克莱因瓶 (Klein bottle)
2.4 网格图 Meshes as Graphs
- 图是一个2-tupel <V,E>
- V:节点的集合 *V: the set of nodes.*
- E:连接两个节点的边的集合 *E: the set of edges connecting two nodes.*
平面性 Planarity
- 一个平面图 A planar graph
- 其顶点和边可以在ℝ2中嵌入以使其边不相交的图 Graph whose vertices and edges can be embedded in ℝ2 such that its edges do not intersect.
- 一个平面图形 A plane graph
- 在平面上画的平面图 A planar graph drawn in a plane.
- 一个平面图 A planar graph
连接 Connected
- 连通平面图为2-tupel <V,E>
- V:节点的集合 V: the set of nodes.
- E:连接两个节点的边的集合 E: the set of edges connecting two nodes.
- 所有节点都通过一条路径沿边缘连接起来 All nodes are connected via a path along the edge.
- F:面是平面的连接部分,是沿平面边缘切割平面时产生的 F: the faces are the connected parts of the plane, which emerge when cutting the plane along the edges
- 三角化:每个面都是三角形的图形。Triangulation: graph where every face is a triangle.
- 连通平面图为2-tupel <V,E>
欧拉公式(用于连通平面图) Euler‘s Formula (for connected planar graphs)
V − E + F = 2
Proof
每个凸多面体都可以转化为连通的平面图,即欧拉公式也成立 Every convex polyhedron can be turned into a connected planar graph i.e., Euler’s Formula holds as well.
多边形网格 Polygon meshes
一个顶点的n环是指存在一条路径到达该顶点的长度为n的顶点集合 n-ring of a vertex is the set of vertices for which a path to that vertex of length n exist.
顶点的价等于相邻边的数量(=相邻顶点的数量) Valence of a vertex is the number of adjacent edges (= number of adjacent vertices).
图的理论问题 Graph theoretical problems
从一个顶点到另一个顶点的最短路径? Shortest path along edges from one vertex to another?
是否存在一条路径,每个顶点只被访问一次? Does a path exist along which every vertex is visited exactly once?
一个由V个顶点组成的三角形网格可以有多少条边? How many edges E can a triangle mesh of V vertices have?
- E ≤ 3V – 6, 3F = 2E (E ≈ 3V, F ≈ 2V)
三角形网格中顶点的平均价是多少? What is the average valence of the vertices in a triangle mesh ?
- < 6 (< 4 in a mesh of quadrilaterals)
哪个三角形网格可以是6规则的(所有的顶点都有价6)? Which triangle meshes can be 6-regular (all vertices have valence 6)?
2.5 多面体的属 Genus of a polyhedron
属:不断开图形到多个部件的闭合切割曲线的最大数目,即“孔”或“柄”的数目。Genus: Maximal number of closed cutting curves that do not disconnect the graph into multiple components, i.e., the number of "holes" or "handles".
2.6 Euler-Poincare 公式 Euler-Poincare Formula
对于一个g属的闭多边形网格,给出了顶点数V、边数E、面数F的关系 For a closed polygonal mesh of genus g, the relation of the number V of vertices, E of edges, and F of faces is given.
V - E + F = 2(1-g)
Proof
χ =(1-g) 被称为欧拉特性 The term χ = 2(1-g) is called the Euler characteristic.
2.7 折线逼近 Polygonal approximation
多边形近似是通过多边形网格对连续曲面的近似 。A polygonal approximation is an approximation of a continuous surface by a polygon mesh.
多边形近似通常由连续曲面上的一组离散点组成,这些点通过边连接。A polygonal approximation typically consists of a discrete set of points of the continuous surface, which are connected via edges.
构造给定点集的连通性(边)称为三角剖分 Constructing the connectivity (edges) for a given set of points is called triangulation
随着插补点个数的增加,误差呈二次递减;误差随着间隔平方的大小而减小
2.8 自适应网格 Adaptive Meshes
多边形近似通常是自适应的,即在高曲率区域使用更多/更小的多边形 Polygonal approximation are typically adaptive, i.e., more/smaller polygons are used in regions of high curvature.
2.9 三角形网格表示 Triangle mesh representation
几何:顶点的位置 Geometry: where are the vertices positioned.
(多边形)拓扑:顶点是如何连接的 (Polygon-)topology: how are the vertices connected .
(网格-)拓扑:多边形是如何连接的 (Mesh-)topology: how are the polygons connected.
显式表示(STL文件):为n个三角形n·3·3 = 9n个浮点数中的每个存储3个顶点 Explicit representation (STL files): store three vertices for each of the n triangles n·3·3 = 9n floats.
2.10 共享顶点表示 Shared vertex representation
又名“索引脸集”表示(OBJ文件) aka „indexed face set“ representation (OBJ, OFF files).
所有顶点的坐标数组(3n个浮点数) Array of coordinates of all vertices (3n floats).
顶点列表中带索引的三角形数组(3n个整数) Array of triangles with indices into the vertex list (3n integers).
12 B/V & 12 B/F ➔ 36 B/V
2.11 索引面集表示属性 Indexed face set representation properties
冗余比显式表示少 Less redundancy than explicit representation.
分离几何和(多边形)拓扑更有效的计算表面 Separation of geometry and (polygon-)topology more efficient computations on surfaces.
网格操作仍然很难实现,例如找到所有1环邻居 Mesh operators still difficult to realise e.g. find all 1-ring neighbours.
2.12 扩展共享顶点表示 Extended shared vertex representation
顶点数组,每个都引用一个相邻的三角形:3n个浮点数+ 1n个整数 Array of vertices, each with a reference to one adjacent triangle: 3n floats + 1n integers.
三角形数组,每个数组都有对相邻三角形的引用(边界:-1):6n个整数 Array of triangles, each with a reference to adjacent triangles (at the border: -1): 6n integers.
16 B/V + 24 B/F ➔ 64 B/V
2.13 翼边数据结构 Winged Edge data structure
顶点数组:位置,引用1条边 Arrays of Vertices: position, reference to 1 edge.
边数组:引用2个顶点,2个面,4条边 Arrays of Edges: references to 2 vertices, 2 faces, 4 edges.
面数组:引用1条边 Arrays of Faces: reference to 1 edge.
120 B/V
2.14 例子:找到给定顶点X的所有关联边。
Given vertex X;
Retrieve incident edge e of X from vertex table;
Let s be e; // working variable
do // move to next edge
Output s; // incident edge
if start vertex of s is equal to X then
s = the successor of the left face of s
else
s = the successor of the right face of s;
end if
while s ≠ e; // loop back if not eq
第一周 End