by vanderZwan · 5y ago · 0 comments
So it looks like you're first applying Delauny triangulation to the color points, and then apply linear interpolation along the created triangles using Barycentric coordinates? Did I get that right? Pretty elegant solution (not to mention all the other little details that went into designing the interface).
edit: wait, if I'm placing a outside the existing shape it's projected to the closest line and linearly interpolates on it? Nice, this is really thought through!
The colors still looks a bit strange along the triangle edges sometimes, and glancing at the source code it seems like you're mixing in linear RGB[0] so it's not that. I guess that just means that I'm looking at a saddle point in the color space?
(this made me wonder how smoothing functions would work for triangle meshes (that aren't secretly quads split into two triangles), and a quick search suggests that could be quite a deep rabbit hole to fall into)
[0] https://github.com/grgrdvrt/poulette/blob/main/src/utils/col...
This is indeed Delaunay triangulation, barycentric coordinates, linear RGB and projections on the edges for the points outside of the mesh. You got everything right!
Having a nice blending along the edges doesn't seem straightforward. I have a few options in mind but nothing obviously right (working with a voronoi diagram instead of a delaunay one, bezier interpolation)
[0] https://www.graphics.rwth-aachen.de/media/papers/sqrt31.pdf