# Is there a tool capable of drawing a triangular linear gradient fill?

I need to draw some shapes filled with linear gradients starting from every point and blending smoothly between points, like an OpenGL standard shading (I guess it is called GL_LINEAR or VERTEX_COLOR), i.e. GIMP / Illustrator / Krita / Paint3D, etc. Something fast and simple.
required result: Most 2D graphics programs are able to do linear gradients with arbitrary orientations. If you don't mind a little work, it is possible to set this up to imitate the 2D linear interpolation across a triangle.

Set up two layers:

• Pick two of the colors, say red and green, and set up a linear gradient between those two colors along the red-green edge.
• In a second layer, set up a linear gradient between blue and transparent-blue (i.e. the same color with alpha = 0). Orient it perpendicular to the red-green edge.
• you've forgot to mention that i also need to account for the length of the edges in cases when the triangle is not regular Oct 20, 2020 at 20:10
• Not sure what you mean. If you put the linear gradient vertices at the right spots everything should be taken care of Oct 20, 2020 at 20:15

a quick working wrapper for OpenGL from R:

require(rgl)
tr.points <- matrix(c(1,0,0, cos(60/180*pi),sin(60/180*pi),0, 0,0,0),
ncol=3, byrow=TRUE)
triangles3d(tr.points, col=c('red', 'green', 'blue'),
lit=FALSE, smooth=TRUE, textype='rgb',
lwd=1.0,