3d形状填充连接到P5.js webGL上的第一个顶点

问题描述 投票:0回答:1

这是我想要达到的效果

这通过处理3.x完成

我正在尝试使用p5.js重新创建相同的效果https://editor.p5js.org/atommic/sketches/kqblWtqln

This is the effect I'm trying to achieve (done with Processing 3.x)

这是当所有顶点具有相同的z值时在p5.js上的外观

当所有顶点都在同一平面上时,没有问题,看起来像预期的一样

P5.js sketch - completely 2d - all vertexes are on the same plane

此形状的X和Y值是2个数组。Z值是mouseX的函数。

for (var i = 0; i < xpos0.length; i++) {

    G = abs((xpos0[i] - mouseX+500)) / (80);
    if (G >= 1) {
        G = 1;
    }
    curveY = curvePoint(-5, 15, 0, 20, G);

    vertex(xpos0[i], ypos0[i], -curveY);  
}

这是使用不同z值时在P5.js上的外观

[移动鼠标并更改某些顶点的Z值时,会发生这种效果。填充以某种方式将所有内容连接到数组的第一个顶点

P5.js - vertexes are on different planes, fill connects to first vertexP5.js - vertexes are on different planes - connection to first vertex is more visible

知道为什么会发生这种情况以及如何避免这种情况?

3d webgl p5.js vertex
1个回答
0
投票

显然,这是一个已知问题,因为在p5js文档中将其描述为预期行为

https://p5js.org/reference/#/p5/vertexenter image description here

© www.soinside.com 2019 - 2024. All rights reserved.