Questioning for a way to modify the interpolating algorithm in vertex rendering

Started by KrLite, January 31, 2023, 14:32:15

Previous topic - Next topic


The topic may be confusing, let me explain it:

When rendering in Minecraft, Mojang uses vertex rendering to render squares and textures, so I should only use vertex rendering. And the problem comes right away:
When rendering with some given vertices, the vertex shaders will decide the final position and color of the vertices and the fragment shaders will decide how the colors blend on the screen, right? However, I found modifying these files cannot change the middle colors produced when vertex rendering, which means, after the processing of the vertices by vertex shaders, the color of each pixel will be passed through a simple interpolating algorithm and then be directly passed to the fragment shaders. I cannot find any way to change how the middle colors are calculated and passed, or how to change the interpolating algorithm.

Is there any way to change the default interpolating algorithm to anything else? For example, replace the interpolating algorithm with a pigment-based blending algorithm or an algorithm to mix the colors with an additional ratio to produce a non-linear gradient. I have all these algorithms but just lack at the knowledge of OpenGL rendering, and cannot find a way to change the interpolating algorithm after days of searching. I'll be no more appreciate if anyone could answer it!

I made the image below to briefly show my question and my understanding of the render process.


I don't think you can simply take and change the interpolation algorithm for the fragments. The only way of achieving your "middle color" is probably by subdividing your quad, i.e. turning your quad into 4 quads, then you'd be able to change the middle intersection vertex of these four quads.

Or another way, probably is possible to pass in UVs, and then based on UVs to implement color blending with some special color in the middle, but that sounds more difficult than subdividing IMO.