GAMES101-现代计算机图形学入门-闫令琪——Lecture 10 Geometry 1 (Introduction) 学习笔记

Lecture 10 Geometry 1 (Introduction)

Many Ways to Represent Geometry

Implicit

  • algebraic surface
  • level sets
  • distance functions

Explicit

  • point cloud
  • polygon mesh
  • subdivision, NURBS

Each choice best suited to a different task/type of geometry

(一)、“Implicit” Representations of Geometry

1、What is implicit geometry
  • Points satisfy some specified relationship
image-20210119233609443

E.g. sphere: all points in 3D, where x²+y²+z² = 1

More generally, f(x,y,z) = 0

隐式几何:表示一定的关系,并不给你实际的点(比如一个球的函数x²+y²+z² = 1)

更通用来讲,定义一个函数f(x,y,z) = 0,只要满足这个式子,就认为这个(x,y,z)是我定义的表面上的一个点,如果能找到所有点就能把这个表面画出来。(如上图)

2、Implicit Surface – Sampling Can Be Hard
image-20210119234043911 image-20210119234052740

What points lie on f(x,y,z) = 0?

Some tasks are hard with implicit representations

隐式几何存在一些问题,如上面的式子,如果一个点满足以上式子的关系,则认为这个点在这个函数所表示的几何的面上,但是如果去求哪些点满足这样一个式子,是相对复杂的问题。虽然我们能直接画出来,是一个圆环的结构,但是单单看式子,很难看出。也就是说隐式几何很难看出函数所表示的几何的“真容”。

3、Implicit Surface – Inside/Outside Tests Easy

f(x, y, z) = x²+y²+z²-1

image-20210119234555578

Is (3/4, 1/2, 1/4) inside?

Just plug it in:f(x,y,z) = –1/8 < 0

Yes, inside.

Implicit representations make some tasks easy

隐式几何也有一些好处,如上面的问题,判断任何一个点和几何的相对位置关系,只需将这个点带入隐式几何的函数中即可判断。如果得到的结果是正数,则说明点在几何外;如果得到的结果是0,则说明点在几何上;如果得到的结果是负数,则说明点在几何内。隐式的表示可以很容易让我们判断一个点在几何内还是外。

(二)、“Explicit” Representations of Geometry

1、What is explicit geometry

All points are given directly or via parameter mapping

image-20210119235015020

显式几何:把所有点都表示出来,如三角形,把面上的点确确实实都表示出来。

另一种显式的方法是通过参数映射。如上图,定义一个uv空间,上面有任意一个点用坐标uv表示,对应每一个uv值都可以映射到三维空间上的某一个点,把uv上所有的点都遍历一遍,就可以得到所有点的xyz,在三维空间中得到一个完整的几何体。

2、Explicit Surface – Sampling Is Easy

f(u, v) = ((2 + cos u) cos v,(2 + cos u) sin v,sin u)

image-20210119235441903

What points lie on this surface?

Just plug in (u,v) values!

Explicit representations make some tasks easy

通过uv的参数映射,我们可以得到三维空间中所有点的xyz,得到这样一个几何体,因此显式几何可以很容易地看出几何图形的“真容”

3、Explicit Surface – Inside/Outside Test Hard

f(u, v) = (cos u sin v,sin u sin v, cos v)

image-20210119235718973

Is (3/4, 1/2, 1/4) inside?

Some tasks are hard with explicit representations

但是显式几何对于判断一个点与几何的相对位置(在几何内还是在几何外还是在几何上)就很困难,通过式子无法得到。

总结:Best Representation Depends on the Task!

(三)、Implicit Representations in Computer Graphics

Many Implicit Representations in Graphics

  • Algebraic surfaces
  • Constructive solid geometry
  • Level set methods
  • Fractals
1、Algebraic Surfaces (Implicit)

Surface is zero set of a polynomial in x, y, z

image-20210120000108902

用隐式去表示一些几何当然可以,但是如果只给出式子,不给出几何图形的样子,我们很难通过式子看到几何的“真容”,而且对于更加复杂的几何(如奶牛),如何去做?无从下手!

2、Constructive Solid Geometry (Implicit)

Combine implicit geometry via Boolean operations

image-20210120000319036

通过一系列基本几何的基本运算,来定义一些新的几何。

在建模软件中运用广泛(布尔运算)。

3、Distance Functions (Implicit)

Instead of Booleans, gradually blend surfaces together using Distance functions:

giving minimum distance (could be signed distance) from anywhere to object

image-20210120000747425

距离函数:空间中任意一点到你想要表述的几何形体上任意一点,他们之间的最小距离。这个距离有正负。如果有一个点在几何形体外面,则最小距离算出来之后加个正号,如果在内部最小距离加符号。把这两个物体各自的距离函数都算出来之后,把两个距离函数做一个融合(blend)再把他恢复成原来的物体,就可以得到上图的效果。

An Example: Blending (linear interp.) a moving boundary

image-20210120001613815

如上图,A表示距离左侧1/3面积都是黑色,B表示距离左侧2/3面积都是黑色,A和B做一次blend,得到的结果就是1/3黑色(左侧),1/3灰色(中间),1/3白色(右侧)。

对A单独做一次SDF(SDF(A)),那么就可以得到A上任意一点的距离函数。我们认为A的黑白分界线为0,若一个点越接近于黑白分界线,距离函数的值越小,越接近于0,向右(白)为正,向左(黑)为负。

同理对B也单独做一次SDF(SDF(B))。

将SDF(A)和SDF(B)做一次blend,得到blend( SDF(A),SDF(B))。那么这个blend后的图像中间即为0,向右(白)为正向左(黑)为负。把这个blend( SDF(A),SDF(B))通过SDF再恢复成原来的形状,就可以知道,0的地方就是他们的边界,非0的地方不是。也就是说,blend两个对应的SDF,实际就是在blend他们的边界。

Can blend any two distance functions d1, d2:

image-20210120002547346

Scene of Pure Distance Functions

image-20210120002633486

隐式几何之间,如果要实现比较圆滑的过度,就是通过距离函数来实现的。

Level Set Methods (Also implicit)

Closed-form equations are hard to describe complex shapes Alternative: store a grid of values approximating function

image-20210120002723211

Surface is found where interpolated values equal zero Provides much more explicit control over shape (like a texture)

距离函数blend出来之后得到的函数,如何再把它恢复成表面?我们只需要把距离函数对应的0的位置全部找出来( f(x)=0 )。

但是当距离函数不太好通过式子表示出来时,可以通过其他方法表示出来,如上图,通过水平集的方法表示。把函数的表述写在了格子上,只需要在格子上找到值为0的那条线,即为表面。(和等高线类似,在不同位置有相同值)至于在什么地方应该等于0?前面已经学过双线性插值了,可以解决这个问题。

Level Sets from Medical Data (CT, MRI, etc.)

Level sets encode, e.g., constant tissue density

水平集还可以被用于三维中

Level Sets in Physical Simulation

Level set encodes distance to air-liquid boundary

image-20210120003401664

包括这种水花四溅的效果,水花和水花融合在一起,也可以通过水平集(距离函数)实现。

4、Fractals (Implicit)

Exhibit self-similarity, detail at all scales

“Language” for describing natural phenomena

Hard to control shape!

image-20210120003513549

分形。

如雪花:每个边上都有六边形,在看更小的地方又有六边形,再看更小的地方又有一个个六边形(递归)。

中间这个植物(西蓝花的一种),看这个植物,有很多凸起,看一个凸起上又有很多凸起,再去看一个小的凸起又有很多凸起…

分形在渲染的时候会引起强烈的走样,因为物体变化的频率实在是太高。

(四)、Explicit Representations in Computer Graphics

Many Explicit Representations in Graphics

  • triangle meshes
  • Bezier surfaces
  • subdivision surfaces
  • NURBS
  • point clouds
1、Point Cloud (Explicit)
image-20210120164019397

Easiest representation: list of points (x,y,z)

Easily represent any kind of geometry

Useful for LARGE datasets (>>1 point/pixel)

Often converted into polygon mesh

Difficult to draw in undersampled regions

最简单的显式几何。

把物体表面上一堆点的每一个点都表示为一个点,也就是说模型由一个个点点组成。如上图,当点云的密度非常大的时候,模型看起来没有什么问题,但是图片自上往下点云密度逐渐稀疏,整个模型也就看不出来了。因此如果想用点云表示物体需要点云的密度非常大。一般在扫描模型的时候会用到(然后还会再转化为一个个面)

2、Polygon Mesh (Explicit)
image-20210120164359786

Store vertices & polygons (often triangles or quads)

Easier to do processing / simulation, adaptive sampling

More complicated data structures

Perhaps most common representation in graphics

多边形面在图形学中得到广泛应用。

The Wavefront Object File (.obj) Format

Commonly used in Graphics research

Just a text file that specifies vertices, normals, texture coordinates and their connectivities

image-20210120164602431

在图形学中如何表示用三角形面形成的物体?

将.obj文件拓展名改为文本文件,就会得到上图的一系列数据。v开头的是记录的顶点信息,vt记录的是纹理信息,vn记录的是面法线信息,f记录的是由哪三个(顶点/纹理/面法线)组成一个三角形。上图记录的是一个立方体的模型数据,有一些多余的数据是由于自动建模中数据冗杂造成的。

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值