# vtk 9 line rendering

**URL:** https://discourse.vtk.org/t/vtk-9-line-rendering/16120
**Category:** Support
**Created:** [November 3, 2025, 5:26pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120 "2025-11-03T17:26:57Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![metamurk](https://discourse.vtk.org/user_avatar/discourse.vtk.org/metamurk/32/9665_2.png) [@metamurk](https://discourse.vtk.org/u/metamurk)
#### Post date: [November 3, 2025, 5:26pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/1 "2025-11-03T17:26:57Z")

</div>

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

 ![image](https://discourse.vtk.org/uploads/default/original/2X/2/2d9bbd6e31ad829c44037c88f5fa9318243710b4.jpeg)

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

 ![image](https://discourse.vtk.org/uploads/default/original/2X/e/e6c54377764a9628d47d576677f1f4c72f4aa9e9.png)

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?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 3, 2025, 8:08pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/2 "2025-11-03T20:08:10Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![metamurk](https://discourse.vtk.org/user_avatar/discourse.vtk.org/metamurk/32/9665_2.png) [@metamurk](https://discourse.vtk.org/u/metamurk)
#### Post date: [November 3, 2025, 8:31pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/3 "2025-11-03T20:31:06Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 6, 2025, 2:23pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/4 "2025-11-06T14:23:07Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ahernsean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ahernsean/32/5874_2.png) [@ahernsean](https://discourse.vtk.org/u/ahernsean)
#### Post date: [November 6, 2025, 8:01pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/5 "2025-11-06T20:01:51Z")

</div>

![image](https://discourse.vtk.org/uploads/default/original/2X/e/e475f025abe36ed0d6449c513ec18dafdfb1ac58.png)

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

---

<div class="post-metadata">

### Author: ![metamurk](https://discourse.vtk.org/user_avatar/discourse.vtk.org/metamurk/32/9665_2.png) [@metamurk](https://discourse.vtk.org/u/metamurk)
#### Post date: [November 7, 2025, 12:10pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/6 "2025-11-07T12:10:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [November 7, 2025, 6:42pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/7 "2025-11-07T18:42:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 12, 2025, 2:09pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/8 "2025-11-12T14:09:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [November 12, 2025, 2:28pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/9 "2025-11-12T14:28:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![metamurk](https://discourse.vtk.org/user_avatar/discourse.vtk.org/metamurk/32/9665_2.png) [@metamurk](https://discourse.vtk.org/u/metamurk)
#### Post date: [November 12, 2025, 2:37pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/10 "2025-11-12T14:37:46Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 12, 2025, 2:56pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/11 "2025-11-12T14:56:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 12, 2025, 3:00pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/12 "2025-11-12T15:00:14Z")

</div>

SSAA is already available: [VTK: vtkSSAAPass Class Reference](https://vtk.org/doc/nightly/html/classvtkSSAAPass.html)

---

<div class="post-metadata">

### Author: ![metamurk](https://discourse.vtk.org/user_avatar/discourse.vtk.org/metamurk/32/9665_2.png) [@metamurk](https://discourse.vtk.org/u/metamurk)
#### Post date: [November 12, 2025, 3:07pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/13 "2025-11-12T15:07:58Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 12, 2025, 5:51pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/14 "2025-11-12T17:51:46Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 12, 2025, 9:58pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/15 "2025-11-12T21:58:26Z")

</div>

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

And F3D uses it: [https://f3d.app](https://f3d.app)

---

<div class="post-metadata">

### Author: ![metamurk](https://discourse.vtk.org/user_avatar/discourse.vtk.org/metamurk/32/9665_2.png) [@metamurk](https://discourse.vtk.org/u/metamurk)
#### Post date: [November 17, 2025, 10:54am UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/16 "2025-11-17T10:54:42Z")

</div>

I tried it out. Unfortunatly SSAA does not work properly with depth peeling.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 17, 2025, 10:58am UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/17 "2025-11-17T10:58:53Z")

</div>

Can you share a screenshot ?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 17, 2025, 12:59pm UTC](https://discourse.vtk.org/t/vtk-9-line-rendering/16120/18 "2025-11-17T12:59:02Z")

</div>

@mwestphal

Is it possible, in VTK 9, to have a 4th antialiasing option consisting of the good old `GL_LINE_SMOOTH` and `GL_POINT_SMOOTH` (`glEnable()`)?
