Interpolating Sampled Color at UVs

When rendering a pixel on a triangle from a texture the engine will interpolate between the UVs of the three vertices of the triangle to get the location to sample from on the texture. I would like a way to instead sample the colors at the UVs of the three vertices and then interpolate between them to get a single color for the entirety of the triangle.

Alternatively a way to generate a single UV per face based upon the UVs of the triangle’s vertices.

91956-example.png

Pictured above is a rough drawing, with an approximation of what is currently happening on the left (With a texture of a green to red gradient with 4 vertex UVs on the green side, and 1 vertex on the red), and on the left is what I am trying to create (Same vertex, UV, and Texture set-up, but with color calculations remaining the same for the entire face).

I think you’ll need C++ mesh pre-processing or a compute shader to calculate an average polygon’s UV. It will also require to have split polygons. Won’t it be easier to script in a 3D package? Separate polygons, for each calculate average UV, write UVs, done.