# (Complex) Mesh gradients

**URL:** <https://discourse.processing.org/t/complex-mesh-gradients/23208>\
**Category:** Project Guidance\
**Created:** [August 12, 2020, 10:11am UTC](https://discourse.processing.org/t/complex-mesh-gradients/23208 "2020-08-12T10:11:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![okn](https://avatars.discourse-cdn.com/v4/letter/o/b3f665/32.png) [@okn](https://discourse.processing.org/u/okn)\
**Post date:** [August 12, 2020, 10:11am UTC](https://discourse.processing.org/t/complex-mesh-gradients/23208/1 "2020-08-12T10:11:35Z")

</div>

Is it possible to create (complex) 2D mesh gradients in Processing? Below a basic example image made in illustrator.

If yes, how would I go about doing this? I’m searching in the direction of per vertex coloring (see this discussion: [Per-vertex color gradient fill](https://discourse.processing.org/t/per-vertex-color-gradient-fill/9679/8)). But this only allows for colors in each corner. Is there a possibility to use locations for each color within a x-y-field?  
Or maybe there is a better approach?

 ![Schermafbeelding 2020-08-12 om 12.07.49](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/af3a641fbf34286380002cae57ab2a52a9661b2c.jpeg)

---

<div class="post-metadata">

**Author:** ![micycle](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micycle/32/201_2.png) [@micycle](https://discourse.processing.org/u/micycle)\
**Post date:** [August 12, 2020, 2:29pm UTC](https://discourse.processing.org/t/complex-mesh-gradients/23208/2 "2020-08-12T14:29:27Z")

</div>

You should be able to do these kind of gradients via diffusion curves:

> [@Understanding the Diffusion Curves Algorithm](https://discourse.processing.org/t/understanding-the-diffusion-curves-algorithm/21605/15):
>
> When using the pixel mask created for each layer (when downscaling) for the diffusion at each level in the upscale, original lines are preserved and the unwanted blobby effect seen previously disappears. \> \> However, whenever different-coloured lines meet (or are close), an artifact is introduced. Not sure why this is… [image] A better example: many lines crossing \> Becomes rather blocky… \> Played around with the diffusi…

Crude example – could probably do with a blur pass:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/bdfc9c4a76889a549430e96c0e6cc9d77b844d7b.png) \> ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1b79a161c45d42c6f77bb38b5fb4a6c2469fa253.jpeg)

I can share code if it looks like a viable solution.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 12, 2020, 9:05pm UTC](https://discourse.processing.org/t/complex-mesh-gradients/23208/3 "2020-08-12T21:05:45Z")

</div>

Hello,

Do a search for “plasma” on [Open Processing](https://www.openprocessing.org/).

`:)`
