vtk 9 line rendering

I upgraded from VTK 8 to VTK 9, and the line rendering quality dropped significantly. VTK 8:

Thats the same scene in vt9. Lines look unsharp and have uneven thicknesses:

Thats a major showstopper for us at the moment. Does anybody know how to reach the same rendering quality than in earlier versions, without that strange artifacts?

Hello @metamurk

Line rendering implementation changed a bit from VTK 8.

Is the render window using multisampling window->SetMultiSamples(4)? Or did you enable FXAA on the renderer renderer->UseFXAAOn()? If not, can you try either of those?

I cannot use multi sampling cause of depth peeling. Multisampling in vtk is not save implemented - it leads to a lot of problems on different drivers. FXAA does not help, line rendering still broken.

I think this line artifacts and blurry unsharp rendering - which are everywhere in dense senes, are a major showstopper bug in vtk 9 which makes the whole framework unusable. Can I write a custom mapper for that or has anyone any suggestions?

Can you share a dataset (or part of your mesh) with which I can reproduce the problem?

You sure you’re not using multi-sampling or FSAA in your original image?

I use FSAA, but these artifacts don’t appear in VTK 8. They do appear in VTK 9 when two lines are rendered on top of each other. The issue is independent of FSAA—the artifacts also occur with anti-aliasing disabled.

I have a hunch that the depth peeling code might not be working properly with the line rendering code. In any case, any tests to find the cause of the artifact should turn off FSAA and especially FXAA, because they’ll just make the artifact harder to identify.

If the artifact is most pronounced when lines cross, then a comparison is needed between rendering such crossing lines

  1. with depth peeling off
  2. with depth peeling on
  3. with depth peeling on, but with the lines added to the render in the opposite order (e.g. upper line added first vs. lower line added first)
  4. all the above with and without MSAA

Edit: actually, if the artifact is visible without MSAA, then there’s no need for a set of test renderings that use MSAA.

Hello,

I was also negativelly surprised when I upgraded to VTK 9. FXAA (the default) is faster but some people don’t like its results, arguing about smear-like effects. The Skyrim game, for exemaple, is often criticized by some gamers because of the use of FXAA but innacuracies can be tolerated in games. The same can’t be said for technical applications. MSAA renders better, but requires a more powerful graphics cards. I ended up letting the anti-alias option to the user.

I had problems with picking and probing with MSAA, with incorrect world coordinates being returned on some systems.

best,

PC

As far as I understand, MSAA is still the default for VTK 9, not FXAA. Some aspects of the line rendering code changed with VTK 9, but the default antialiasing method did not.

The Problem is that msaa in vtk 9.0 on Windows is buggy. It doesn’t work with depth peeling and crashes on multiple drivers.

FXAA creates artifacts which are a showstopper, so also not useable.

We cannot upgrade to higher versions because vtk devs broke Windows java Support.

I just can try to get multi sampling to run with depth peeling or write an custom line shader with proper modern aa or both.

Perhaps it would be good if VTK 9 had a 3rd antialiasing option consisting of the good old GL_LINE_SMOOTH and GL_POINT_SMOOTH (glEnable()). Medical and Earth Sciences (my case) could do with FXAA to void the issues with MSAA. However, those developing CAD-like applications with lots of flat lines and faces could greatly benefit from it. Super-sampling (expensive, but the nicest) could also be available.

SSAA is already available: VTK: vtkSSAAPass Class Reference

I think I will implement an custom line mapper which implement analytical distance bases line rendering in shader.

But add multi sampling would be good also. Does anyone know wheter I can cherry pick changes into vtk 9 and get it to run with depth peeling?

Do you know of an example of SSAA usage? Thanks.

Test is here: https://gitlab.kitware.com/vtk/vtk/-/blob/v9.5.0/Rendering/OpenGL2/Testing/Cxx/TestSSAAPass.cxx

And F3D uses it: https://f3d.app