Mesh rendering worse between VTK 8.1 and 9.2.6

I’m noticing that, generally, mesh renderings look worse after updating my program to VTK 9.2.6 than they looked using 8.1. It’s somewhat subtle, but the lines somehow don’t look as sharp, particularly when zoomed out. I’ll try to attach some example before-and-after screenshots below.

I don’t think I’m doing anything too fancy with the mapper and actor, and I didn’t change anything in my code when moving to the new VTK. I’m guessing some rendering defaults changed between the versions - does anyone have any advice?


There have been quite a few changes w.r.t surface with edges, coincident topology resolution, wide lines, etc. since v8.1. In particular, the surface with edges are done in a geometry shader where edges are “filled in” triangle strips while drawing the surface. You might want to increase the line width a little bit to show more of the lines.

You could also play with the coincident topology resolution on the mappers to make the lines always appear above. This requires that you use a separate actor for the lines

Thanks for the ideas, these set me on the track to finding this [commit]. (update and improve the coincident rendering code · Kitware/VTK@3052137 · GitHub)

For what it’s worth, I’ve found that I get near identical results between VTK 9.2.6 and VTK 8.1 if I set the polygon and line offset parameters back to the old values prior to this commit, i.e.:

        // the following two lines were consistent between VTK 8.1 and 9.2.6
        vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
        vtkMapper::SetResolveCoincidentTopologyPolygonOffsetFaces(0);

        // the following two lines I've needed with VTK 9.2.6 to match rendering with 8.1:
        vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(2, 2);
        vtkMapper::SetResolveCoincidentTopologyLineOffsetParameters(1, 1);

Even though the commit seems to suggest that the ‘factor’ parameter is no longer used, I’ve found that indeed it does still make a difference.

Support for factor was re-added in Bring back factor for coincident topology resolution · Kitware/VTK@5e9c319 · GitHub

1 Like

I use the factor throughout my code. Currently, I use the master branch (two weeks old, I guess). You can either use this or layers to force things to be on top, but I really that you can set multiple values, which gives a lot of flexibility.

1 Like