3d custom shape fill outside stroke

I’m trying to recreate a code that ran well in Processing 3
When the shape is not a plane but has different z values for some vertexes - it fills the shape very strangely.

Any ideas how to avoid this?

This is how it looks flat
image

This is how it looks when it has a "wave"
image

This is what it’s supposed to look like (ie my original Processing sketch)
image

Link to the sketch
https://editor.p5js.org/atommic/sketches/kqblWtqln


Edit:

I’ve played with the material and it seems like it connects all the vertexes to the first vertex in the arrray for some reason (P5JS screenshot)
Any idea why this is happening and how to avoid it?

image

1 Like

Apparently this is known:

from https://p5js.org/reference/#/p5/vertex
image

1 Like