Mesh color interpolation

So I’m coloring a set of meshes using points as centers for color spread. I calculate distance from each vertex of the mesh to these center points, solve weighted averages between the sets and as a result get beautiful gradient of color over the meshes. I found a way to semi-control the edge of color and how quickly it shifts from one to another, however what I’m hoping to have is a clear cut between colors + get clean curve regions defining the boundaries of each color (check the images below for explanation). Also, vertices where 2 colors are blending get colored in another set of very similar colors creating a nice looking gradient.

I’m assuming this has to do with a different color interpolation (correct me if I’m wrong), however this is where my knowledge is lacking. Ideally, I would have a way of controlling a few things:

  • a number of different colors that get introduced when blending from one to another (i.e. there’s only 1 in-between color when blending from dark blue to turquoise, as opposed to it being ~10 now, depending on how close the vertices are to the blending edge);
  • color region curves and their smoothing (is the curve dividing the mesh into 2 different colors pixelated or smooth)

Attaching screenshots and GH definition. Hopefully it’s clear enough. (44.9 KB)

If you manage to convert the per-vertex color to a numerical value, you can then use Laurent script

and divide your mesh into fragments…

This actually works almost perfectly.

I’m deconstructing vertex color into RGB values and multiply them, making each color a unique number and use these numbers to divide the mesh. The only problem is that divided meshes don’t have clean naked edges, which is actually what I’m trying to achieve. But I can work with that. Thanks!