2010年2月3日星期三

SubD + Tessellator unit


1. subdivision surfaces(subD)的却已经很流行了, 例如Maya, ZBrush, Modo等都支持对这类型曲面操作。这操作暂时多数是局限在high level上增加details, 而不是动态的编辑base mesh来得到新的曲面,为什么呢?第一种操作的base mesh, high level surface是死的死固定的,而后者第二种操作中mesh是改变的,要实时地生成面数目更多的high level是不容易的。
第一种操作,一般是在high level surface增加细节, 然后生成normal/bump/displacement map,连带base mesh一起输出。在后续的渲染中,只要将这些map bake到base mesh就可以了. 

2. 虽然subD这么prevalence了, 但是在游戏等实时应用程序中还是以三角片组成的mesh为主,主要原因是什么?其一是底层的硬件主要对三角片渲染做了优化. 所以不管你上层用什么表示方式,最后还是得换成三角片来化,(也是出于这个原因,我觉得point cloud也是, 最后还是三角剖分然后再渲染出来)。Direct3D 11 中加入到tessellator unit好处就是可以在GPU上动态地生成high level mesh(base mesh还是在CPU上),而不需要在CPU中做好几次subd得到很密的high level然后再放到GPU上渲染。但这里有一个关键点算法,就是high level surface(其实应该说成是limit surface)的参数表示, 因为tessellator unit中的Hull shader需要根据base mesh生成limit surface上每一个patch(曲面片)的参数表示, 例如如果默认是cubic bezier patch,那么只要计算出这个patch的控制点就ok了. (怎么计算呢?后面提到)。得到这些控制点之后,我们等于得到了这个patch的数学表示(Hardware tessellation时候默认是用cubic bezier patch, 14个控制点定了, 特定将这个数学表达式都告诉了GPU), 为了要渲染出来,还是回到要先做三角化嘛。于是就有了后面的Tessellator和Domain Shader, 复杂采样和添加新的顶点. 

3. 上面的问题:这么计算出patch的控制点呢?主要地请参考:
[C. Loop, S. Schaefer. Approximating Catmull-Clark Subdivision Surfaces with Bicubic Patches, Siggraphic 2008, the so called ACC]
[C. Loop, S. Schaefer, T. Ni, I. Castano. Approximating Subdivision Surfaces with Gregory Patches for Hardware Tessellation.  Siggraphic Asia 2009]

4. 我现在的理解和代码实现还停留在mesh geometry的角度,还没有对加上displacement map之后会产生texture seams有更深的理解. 
[AMD. GPU Tessellation for Detailed, Animated Crowds] 
[PTex] 这两个文章中都提到了filtering. 

2010-2-2.


base mesh --> CPU subd   --> hight level mesh --> limit mesh                                                  --> vertex buffer / index buffer.
               --> CPU calculate the control points for ACC patches, --> Tessellation on CPU             --> vertex buffer / index buffer.
               --> CPU calculate the control points for ACC patches, --> Tessellation on GPU using bindable uniform buffer(SDK 10) .
               --> Hull shader                                                     --> Tessellator + Domain Shader --> render.
2010-02-03.


[2010/6/6 updated] 
What is tessellation? 
在[Real-time Rendering, 3rd]书中的定义比较清晰,记录一下:"To display a curved surface in a real-time rendering context, we usually need to create a triangle mesh representation of the surface. This process is known as tessellation. The simplest form of tessellation is called uniform tessellation." 事实上这书在这方面也讲得相当详细.

What is hardware tessellation?
在[Real-time Rendering, 3rd]书中的说法,记录一下: "An efficient way of providing inexpensive data expansion of geometry is to send higher-order surfaces to the GPU and let it tessellate the surface." 

下面来看看tessellation factor的概念.
1. 细分level每一增加一步, 都会增加4倍的三角形数目, 所以tessellation factor就没有必要跟这个subD level一致.
2. 细分level对应每一个边都是一样的, 不利于LOD中adjacent patch的过渡链接, 于是有了像第三个图那样的tessellation方法, 并且三个边可以有三个不同的tessellation factor. 在Direct3D 11中是由hull shader计算出来的, 另一个hull shader需要计算的当然就是control points了.

References:
Moreton H., Wateright Tessellation using Forward Differencing. In Graphics Hardware 2011. 提出了fractional tessellation概念.
http://developer.amd.com/gpu_assets/Real-Time_Tessellation_on_GPU.pdf 

没有评论:

发表评论