I am developing a visualization tool in OpenGL to visualize the output of a 3D element modeling application. The application uses a tetrahedral mesh (but I only consider the outer faces, which are triangles). The result is a scalar variable that I want to map to the color map (I already know how to do this). The tricky part is that the value of the variable in each cell is given by a polynomial function (I think it has degree 3, but not yet completed) of the coordinates in this cell.
In OpenGL, if I use a “smooth” shader model, then if I create a polygon and give each vertex a different value, then it will automatically interpolate (linearly) between the values at the vertices to get the color of the value at the points inside. But it just gives a linear function in each cell, and I want it to be a non-linear function that I specify. Is there any way to do this?
(Of course, one solution would be to interpolate “manually” by drawing each cell as a composite of much smaller OpenGL polygons that are small enough so that the color does not change much in each of them. But I want to know if OpenGL has a solution.)
source
share