Pseudocolor rendering of nodal variables on quads

When rendering, OpenGL (hardware and software) drivers typically split quads into two triangles. As a result, in VisIt's Pseudocolor plots we don't always see the expect bilinear interpolation for nodal quantities rendered on a quads.

Here is an example of the two choices for subdivision: This first aligns with what we expect, and the second shows subdivision artifacts.

Sub div correct.png
Sub div bad.png

The automatic subdivision that OpenGL uses for quads out of our control.

Attempted Solutions

Subdivide into smaller quads

To try to address this we created a "Subdivide Quads" Operator. In its current form this operator does not solve the problem, since it simply subdivides quads into smaller quads which can yield the same bad behaviour.

Here is an example:

Sub div quads op bad.png

Subdivide into 4 triangles

To get a better representation, you can subdivide such that the resulting triangle interpolations better match that expected quad bilinear interpolation:

Sub div 4 tris.png

This helps for some cases, but isn't a 100% solution.

Future Solution?

The only proper way to tackle this problem is to create a fragment shader that does bi-linear interpolation on each triangle using the 4-points of the quad.

  • For each quad emit two triangles
  • Pass the 4 texture values, and missing vertex (4th) coordinates to a vertex shader.
  • Project the 4th point just as the others
  • Make sure the extra point arrives in the fragment shader some how.
  • Implement bi-linear interpolation in the fragment shader.