Gradient interpolation with 3+ points

I implemented an n-point shader for OPENRNDR (a different framework). Maybe that approach is efficient enough? If you can read GLSL you might understand the code at orx/NPointGradient.kt at master · openrndr/orx · GitHub and port it to Processing.
Basically it’s passing an array of positions and array of colors, then using them to calculate the colors of every pixel. The built in uniforms for the shader are listed here.

It is fast enough for real time animation.

2 Likes