镶嵌控制点边缘上的伪影

Artifacts on edges from tesselation control points

第一张图片近距离展示了神器:

第二个在上下文中显示它(见右下角):

网格由 n x n 个顶点组成的网格构建,这些顶点经过三角剖分形成网格。顶点以 1/n 单位分隔。看起来 gl clear 颜色通过连接网格中原始顶点的线显示(导致网格)。显示清晰颜色的线条形成四边形。每个细分面片的顶点数为 3。如果没有细分,则不存在工件。启用曲面细分后,伪像会出现,但不会随着曲面细分因子的变化而变得或多或少变得明显。有没有人见过像这样的曲面细分结果?如果是这样,他们的根本原因是什么,是否有任何解决办法?我开始怀疑一些数字错误,但在曲面细分之前缩放地形也不会影响此工件的可见性。

应要求,相关代码如下:

苔丝控制:

float GetTessLevel(float d1, float d2) {
    return 2;
}

void main() {
    TEworldPos[gl_InvocationID] = TCworldPos[gl_InvocationID];
    float EyeToVertexDistance0 = distance(cameraPos, TCworldPos[0]);
    float EyeToVertexDistance1 = distance(cameraPos, TCworldPos[1]);
    float EyeToVertexDistance2 = distance(cameraPos, TCworldPos[2]);

    // Calculate the tessellation levels
    gl_TessLevelOuter[0] = GetTessLevel(EyeToVertexDistance1, EyeToVertexDistance2);
    gl_TessLevelOuter[1] = GetTessLevel(EyeToVertexDistance2, EyeToVertexDistance0);
    gl_TessLevelOuter[2] = GetTessLevel(EyeToVertexDistance0, EyeToVertexDistance1);
    gl_TessLevelInner[0] = gl_TessLevelOuter[2];

苔丝评价:

uniform mat4 viewProj;
void main() {
vec3 posFromBary = gl_TessCoord.x * TEworldPos[0] +
                       gl_TessCoord.y * TEworldPos[1] +
                       gl_TessCoord.z * TEworldPos[2];
gl_Position = viewProj * vec4(posFromBary, 1.0);
}

问题是由至少 Intel Iris Pro 1536 MB 集成 GPU 上似乎存在的 GPU 错误引起的。调用任何 GLSL noise functions in a pipeline that also tessellates at least one patch causes these artifacts. Noise by itself and tessellation by itself work as expected, but combined produce small artifacts along the edges of tessellated patches as illustrated in the above example. A temporary workaround is to use this open-source glsl simplex noise implementation(此 repo 中的其他方法可能运行良好,但我只测试了这个),与 tesselation 结合使用时不会产生任何工件。