且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

GL_Triangles带有细分着色器

更新时间:2023-01-05 08:49:53

补丁只是点的集合,没有真正的内在结构……您的TCS和TES才是有意义的.与GL_TRIANGLES(严格由3个顶点定义)不同,GL_PATCHES每个修补程序没有预定义的顶点数.您可以使用以下命令自己设置补丁中的顶点数:

A patch is just a collection of points with no real intrinsic structure... your TCS and TES are what make sense out of them. Unlike GL_TRIANGLES (which is strictly defined by 3 vertices), GL_PATCHES has no pre-defined number of vertices per-patch. You set the number of vertices in a patch yourself with:

glPatchParameteri ​(GL_PATCH_VERTICES​​, N);
// where N is some value less than GL_MAX_PATCH_VERTICES

然后,每个绘制的每个N个顶点都定义一个新的面片基元.

Then, every N-many vertices drawn defines a new patch primitive.

补丁实际上只是用于评估表面的控制点的集合.从字面上看,这就是为什么有一个名为Tessellation Control Shader optional 阶段将数据馈送到Tessellation Evaluation Shader的原因.没有更多关于您要评估的表面类型的详细信息,关于将其可视化的唯一方法是将其作为点云(例如GL_POINTS).

Patches are really just a collection of control points for the evaluation of a surface. This is literally why there is an optional stage called Tessellation Control Shader that feeds data to a Tessellation Evaluation Shader. Without more details about the type of surface you are evaluating, about the only way to visualize them is as a point cloud (e.g. GL_POINTS).

  

  

红色点是控制点(GL_PATCHES中的顶点),蓝色线是人造的(仅出于可视化目的),黑色正方形是被评估的曲面(镶嵌细分评估着色器"的结果).如果您在细分化评估之前尝试将其可视化,那么您的补丁只会是红点而已,您将有一段时间尝试理解它们.

The red points are the control points (vertices in GL_PATCHES), the blue lines are artifical (just for the sake of visualization) and the black squares are the evaluated surface (result of a Tessellation Evaluation Shader). If you tried to visualize this before tessellation evaluation, then your patch would be nothing but red dots and you would have a heck of a time trying to make sense of them.