这个系列是GAMES301-曲面参数化(GAMES 301: Surface Parameterization)的同步课程笔记。课程内容涉及曲面参数化的基本理论与问题描述、面向离散网格的参数化、基于基函数表示的连续参数化、共形参数化、曲面参数化的应用等。本节课主要介绍曲面参数化在Atlas生成和艺术设计领域中的应用。
Atlas Generation
参数化在图形学中最广泛的应用是进行纹理映射(texture mapping)。我们可以把三维模型表面的各种信息记录到二维纹理上,然后在进行渲染时从纹理贴图上读取信息。
![](https://search.pstatic.net/common?src=https://i.imgur.com/sTOWzQ7.png)
因此atlas可以定义为模型空间到纹理空间的一个映射。当模型的几何比较复杂时直接计算一个全局的参数化可能会比较困难,因此在工业界也会把模型划分为不同的区域分别进行参数化然后记录到一张二维纹理上。
![](https://search.pstatic.net/common?src=https://i.imgur.com/hmmuP1b.png)
Generation Process
atlas生成的过程就包括网格切割、参数化以及摆放等几步。
![](https://search.pstatic.net/common?src=https://i.imgur.com/d7iDGd0.png)
Mesh Cutting
网格切割会将模型表面切成不同的区域。同时我们希望切割后模型参数化的扭曲要尽可能低,而且割线的长度要尽可能小。
![](https://search.pstatic.net/common?src=https://i.imgur.com/Oph6Hto.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/IAsa5Td.png)
Parameterization
进行参数化时我们可以使用前面介绍过的各种全局单射方法来实现低扭曲的参数化。
![](https://search.pstatic.net/common?src=https://i.imgur.com/1WVBwFd.png)
Packing
得到每一个分片的参数化后就需要把这些平面图形组装到一张纹理图像中。在进行组装时我们需要考虑摆放效率(packing efficiency, PE),其定义为参数化区域的面积占整个纹理区域面积的比例。显然我们希望PE要尽可能高,这样可以节约存储空间。除了PE之外,边界长度(BL)、切割块数(CN)以及几何扭曲也都可以作为评价摆放结果的指标。
![](https://search.pstatic.net/common?src=https://i.imgur.com/lFFYhBR.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/7IjcOSo.png)
atlas除了用于纹理映射外还可以应用在各种几何处理任务中作为一种记录信息的手段。
![](https://search.pstatic.net/common?src=https://i.imgur.com/L7VrDef.png)
Mesh Cutting
目前常用的网格切割方法包括points to path以及segmentation两大类。
![](https://search.pstatic.net/common?src=https://i.imgur.com/Tu7dve3.png)
Points to Path
points to path会在网格上寻找一些高扭曲的点,然后把它们连起来对模型进行切割。在寻找高扭曲的顶点时一般会使用一些启发式的算法来进行选取,然后利用最小生成树来将这些点连起来实现切割。
![](https://search.pstatic.net/common?src=https://i.imgur.com/W7HShSk.png)
Segmentation
segmentation会直接对模型进行分割,同时希望分割后每一块表面都具有相对小的几何扭曲。
![](https://search.pstatic.net/common?src=https://i.imgur.com/G1nzoaI.png)
因此我们需要一些方法来预测不同表面参数化后的几何扭曲。比如说可以使用分割后区域的轴向以及区域内每个三角形法向之间的差异来进行估计,如果它们的差异为0则说明该区域是一个圆锥曲面对应的几何扭曲为0。
![](https://search.pstatic.net/common?src=https://i.imgur.com/7ZacIg8.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/giid36b.png)
然后结合Lloyd算法进行迭代就可以得到曲面的分割。这样的迭代过程与k-Means还有CVT算法几乎一致。
![](https://search.pstatic.net/common?src=https://i.imgur.com/mEEcFiV.png)
Packing Efficiency
在游戏行业中一般会把大量模型的贴图放到同一张纹理图像中方便读取,此时atlas的PE就会对纹理图像的大小产生重要影响。我们希望PE能够尽可能高,这样可以极大地节约内存和硬盘存储空间。
![](https://search.pstatic.net/common?src=https://i.imgur.com/9IAASHA.png)
不过遗憾的是最优摆放问题本身是NP-hard,目前没有高效的求解算法。
![](https://search.pstatic.net/common?src=https://i.imgur.com/NM1tEKn.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/FYdZb3w.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/LHRSJOx.png)
因此更常用的处理方法是对参数化的结果进行一些额外的处理来提高PE。
![](https://search.pstatic.net/common?src=https://i.imgur.com/sAwotOh.png)
比如说在box cutter算法中会直接切掉超出纹理图像的部分,然后贴到空白处从而提高PE。不过这个算法没有办法保证一定能够获得很高的PE。
![](https://search.pstatic.net/common?src=https://i.imgur.com/t4Eu5IU.png)
注意到矩形在二维平面上的摆放问题是相对容易解决的,因此我们可以把输入的参数化区域转换成一个矩形区域来处理。
![](https://search.pstatic.net/common?src=https://i.imgur.com/jlaoW7n.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/V9AGVh2.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/IAmjrV3.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/uMrcTGT.png)
整个基于矩形的摆放算法流程如下:
![](https://search.pstatic.net/common?src=https://i.imgur.com/9LpgK4U.png)
Art Design
Peeling Art
参数化除了在CG领域有广泛应用外也启发了很多艺术创作的思路。比如说艺术家可以在橘子表面上进行雕刻,然后把橘子皮展开就得到了不同形式的图案。
![](https://search.pstatic.net/common?src=https://i.imgur.com/bJzVXgq.png)
但是这样的艺术形式需要进行大量的练习,一个好看的艺术图案需要长期的练习和试错。
![](https://search.pstatic.net/common?src=https://i.imgur.com/iMTJHiG.png)
从算法设计的角度来看,这样的艺术形式本质是在球面上寻找割缝然后再展开到二维平面上从而获得所需的图案。
![](https://search.pstatic.net/common?src=https://i.imgur.com/uPoHM1j.png)
目前已经有了一些相关的研究,但它们都很难保证展开后的形状接近于复杂的输入的形状。
![](https://search.pstatic.net/common?src=https://i.imgur.com/r1mvN9w.png)
直接生成割缝往往是比较困难的,但把二维形状映射到球面是相对容易的。如果映射后的形状可以完整包住整个球面就得到了所需的割缝。
![](https://search.pstatic.net/common?src=https://i.imgur.com/p8rM5tV.png)
更严格来说,我们需要把一个二维形状映射到球面上同时最小化几何扭曲以及曲面外的面积。
![](https://search.pstatic.net/common?src=https://i.imgur.com/LCcb1DF.png)
我们希望映射尽可能使一个等距映射,因此可以使用ARAP中使用的几何扭曲能量。
![](https://search.pstatic.net/common?src=https://i.imgur.com/PG16KpM.png)
而对于球面上不属于图形的区域,我们希望它的面积尽可能小。这里使用了rank-one energy来使其发生退化。
![](https://search.pstatic.net/common?src=https://i.imgur.com/j3bN9Cc.png)
除了优化算法外我们还需要考虑如何跟用户进行交互。有一些性质即使在优化后也很难在球面上进行闭合,这就需要一些交互式的反馈来提醒用户修改输入形状。
![](https://search.pstatic.net/common?src=https://i.imgur.com/4AaIyVN.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/t0WHauG.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/si6xpp1.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/ca3LiFX.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/9pc0UCh.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/lhlwLEt.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/7D8gvjt.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/EWtrCYj.png)
最后对球面映射上的边界进行简化就得到了所需的割缝。
![](https://search.pstatic.net/common?src=https://i.imgur.com/5h9f85E.png)
在实际进行切割时可以把割缝按照经纬度画到橘子皮上。
![](https://search.pstatic.net/common?src=https://i.imgur.com/C910jqm.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/6rxtBQk.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/tqp8hqp.png)
Paper Craft
纸模是一种非常常见的艺术形式,我们把模型展开放到二维平面上再重新粘到一起就得到了纸模。
![](https://search.pstatic.net/common?src=https://i.imgur.com/GyhMfvX.png)
然而大部分纸模都是基于简单几何形状的。对于复杂的三维模型来说,把曲面直接展开需要满足可展曲面Gauss曲率处处为0的条件。
![](https://search.pstatic.net/common?src=https://i.imgur.com/21p7UZi.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/J9Dr6Ky.png)
显然大部分曲面都不是可展曲面,因此我们希望可以用一系列分片的可展曲面来近似原始曲面。
![](https://search.pstatic.net/common?src=https://i.imgur.com/mCmKjFp.png)
我们可以使用前面介绍过的分割方法来生成割缝或者分割,但这些方法往往会得到一些过于明显的割缝。
![](https://search.pstatic.net/common?src=https://i.imgur.com/Nvd2doZ.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/jkZ7F9m.png)
一种更好的策略是从整体出发,首先使用可展曲面对原始形状进行一个近似。然后再进行分割,此时得到的分片曲面都近似于可展曲面。
![](https://search.pstatic.net/common?src=https://i.imgur.com/QUPnMSu.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/zWKhHYJ.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/B6c9Fua.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/qFTrsyF.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/q5qqJhu.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/p1I2cwP.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/KsvasUG.png)
而在进行分割时则可以先生成一个过分割,然后逐渐合并来得到合适的分割结果。
![](https://search.pstatic.net/common?src=https://i.imgur.com/OwkEacx.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/Qtl5sg1.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/M1QbRbn.png)
得到分割的曲面后还可以继续对分片曲面的Gauss曲率进行修正。
![](https://search.pstatic.net/common?src=https://i.imgur.com/b4XhJrb.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/FsvfdEV.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/CivraUk.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/g36iIH1.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/FYoyxRl.png)