# 3d custom shape fill outside stroke

**URL:** <https://discourse.processing.org/t/3d-custom-shape-fill-outside-stroke/20661>\
**Category:** p5.js\
**Created:** [May 9, 2020, 10:10am UTC](https://discourse.processing.org/t/3d-custom-shape-fill-outside-stroke/20661 "2020-05-09T10:10:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dehyde](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dehyde/32/5153_2.png) [@dehyde](https://discourse.processing.org/u/dehyde)\
**Post date:** [May 9, 2020, 10:10am UTC](https://discourse.processing.org/t/3d-custom-shape-fill-outside-stroke/20661/1 "2020-05-09T10:10:25Z")

</div>

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](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f2f45cb263a8b308cd063f8780dc833c15c345f2.png)

**This is how it looks when it has a "wave"**  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b021e85c4136294c8642df705c3c0c9b8a11a400.png)

**This is what it’s supposed to look like (ie my original Processing sketch)**  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f8d85d683f9c4d37d81b34b4fafd6b9a0e993159.png)

Link to the sketch  
[https://editor.p5js.org/atommic/sketches/kqblWtqln](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](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/4dd34c10954a0c91c5fa905e2fcc72018483b49d.png)

---

<div class="post-metadata">

**Author:** ![dehyde](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dehyde/32/5153_2.png) [@dehyde](https://discourse.processing.org/u/dehyde)\
**Post date:** [May 10, 2020, 6:07am UTC](https://discourse.processing.org/t/3d-custom-shape-fill-outside-stroke/20661/2 "2020-05-10T06:07:29Z")

</div>

Apparently this is known:

from [https://p5js.org/reference/#/p5/vertex](https://p5js.org/reference/#/p5/vertex)  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/6abebc485b790f03e62f6781228aa9e823e753aa.png)
