# vtkPolyData actor behaviour is changed in VTK \>= 9.1

**URL:** https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037
**Category:** Support
**Tags:** python
**Created:** [January 9, 2024, 12:44pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037 "2024-01-09T12:44:38Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Edoardo\_Pasca](https://discourse.vtk.org/user_avatar/discourse.vtk.org/edoardo_pasca/32/742_2.png) [@Edoardo\_Pasca](https://discourse.vtk.org/u/Edoardo_Pasca)
#### Post date: [January 9, 2024, 12:44pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/1 "2024-01-09T12:44:38Z")

</div>

Hi all,

In my application I show slices of `vtkImageData` with orthogonal view, i.e. with the camera looking at slices on the XY, XZ or YZ plane along the normal to the slice plane).  
On the scene I add other 3D actors from different types of sources such as `vtkCubeSource` or `vtkSphereSource`. Before displaying I slice the `vtkPolyData` with 2 planes just above and below the image slice.

Trying to upgrade from VTK 8 to VTK 9 I found an issue on how VTK renders the poly data. In particular in ortho view the actor disappears completely for `vtkCubeSource`.

I created a minimal [example](https://github.com/vais-ral/CILViewer/blob/cube_source/Wrappers/Python/examples/cubesource_clip.py).

I installed VTK on windows with mamba with the command

`mamba create -n vtkxy vtk=x.y -c conda-forge`

The behaviour of the mapper (I should think) has changed between version \<9.1 and \>=9.1. In particular in version \<=9.0.3 (including 8.2) I get lots of warnings of this sort

`vtkOpenGLPolyDataMapper:329 WARN| vtkOpenGLPolyDataMapper::SetGeometryShaderCode was deprecated for VTK 9.0 and will be removed in a future version. Use vtkOpenGLShaderProperty::SetGeometryShaderCode instead.`

These warnings disappear in version \>9.1 and were not present in 8.1.2.

With VTK version \<9.1 the clipped `vtkCubeSource` appears clearly in the rendered image, also with orthogonal view, while it disappears in VTK \>=9.1.

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

By slightly tilting the position of the camera from orthogonal view, the polydata actor is now visible in both versions, though it’s rendered differently. In particular VTK\>=9.1 doesn’t seem to respect the very large line width that I set to the actor.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/9/91a04ab3713cff4aad74fa2dac5d09988332b5d5.png)

Finally, I tried with a vtkSphereSource and the rendering different but in the ortho view the polydata is still visible.

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

How can I view the profile of the clipped poly data in VTK \>=9.1?  
Are there settings to the `vtkPolyDataMapper`/`vtkLODActor` (or `vtkActor`) that I can set to achieve this?

Thanks

Edo

---

<div class="post-metadata">

### Author: ![Edoardo\_Pasca](https://discourse.vtk.org/user_avatar/discourse.vtk.org/edoardo_pasca/32/742_2.png) [@Edoardo\_Pasca](https://discourse.vtk.org/u/Edoardo_Pasca)
#### Post date: [January 9, 2024, 10:11pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/2 "2024-01-09T22:11:17Z")

</div>

I tried to use a number of `vtkProperty` and I managed to produce something reasonable by adding the following:

```auto
actor.GetProperty().SetRepresentationToWireframe()
actor.GetProperty().SetRenderLinesAsTubes(True)

```

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

Notice that in VTK \< 9.1 the profile was visible with the default that is: representation to surface and render lines as tubes `False`.

Any other insight is welcome.

Edo

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [January 10, 2024, 5:54pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/3 "2024-01-10T17:54:11Z")

</div>

Cc @sankhesh

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [January 10, 2024, 6:06pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/4 "2024-01-10T18:06:10Z")

</div>

@Edoardo_Pasca Most likely you were seeing a side-effect of the issue fixed in [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/10403](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10403) where surface with edges had a padding added to the edges to compensate for thick lines.

---

<div class="post-metadata">

### Author: ![Edoardo\_Pasca](https://discourse.vtk.org/user_avatar/discourse.vtk.org/edoardo_pasca/32/742_2.png) [@Edoardo\_Pasca](https://discourse.vtk.org/u/Edoardo_Pasca)
#### Post date: [January 11, 2024, 8:14am UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/5 "2024-01-11T08:14:08Z")

</div>

Thanks @sankhesh

Is this in master or in any stable release yet?

Thanks

Edo

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [January 11, 2024, 1:00pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/6 "2024-01-11T13:00:48Z")

</div>

No, it’s not in any VTK release. @sankhesh, does it make sense to backport to 9.3?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [January 11, 2024, 2:30pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/7 "2024-01-11T14:30:46Z")

</div>

It would be a surprising change to see the behavior change in a patch release.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [January 11, 2024, 3:13pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/8 "2024-01-11T15:13:09Z")

</div>

I asked because it seems like it has been this way since 9.1 and it was described as a “fix”. But this is not my knowledge area of VTK, so will defer.

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [January 12, 2024, 5:17pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/9 "2024-01-12T17:17:28Z")

</div>

To clarify, I think that @Edoardo_Pasca’s reported issue is a non-issue and that the behavior he was seeing before was incorrect. When you clip a thin box and view it face down in an orthogonal projection, you should not expect to see anything rendered. My original comment meant that this incorrect behavior was fixed in the referenced merge request. Increasing line width and/or rendering lines as tubes seems right for your use case.

---

<div class="post-metadata">

### Author: ![Edoardo\_Pasca](https://discourse.vtk.org/user_avatar/discourse.vtk.org/edoardo_pasca/32/742_2.png) [@Edoardo\_Pasca](https://discourse.vtk.org/u/Edoardo_Pasca)
#### Post date: [January 13, 2024, 3:28pm UTC](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/10 "2024-01-13T15:28:13Z")

</div>

After all this discussion, I do not quite understand **when** was the bug.

> [@sankhesh](#):
>
> When you clip a thin box and view it face down in an orthogonal projection, you should not expect to see anything rendered.

Since this seems to be what I observed in VTK \>=9.1, I deduce that VTK \>=9.1 is correct.  
The bugfix described [above](https://discourse.vtk.org/t/vtkpolydata-actor-behaviour-is-changed-in-vtk-9-1/13037/4) seems to have been merged onto master and is not even in VTK\<=9.3.

So now I don’t understand the relationship of the issue above with this one.

> [@sankhesh](#):
>
> Increasing line width and/or rendering lines as tubes seems right for your use case.

For the record, in my test increasing the line width doesn’t seem to have any effect in orthogonal view and the **only** way to visualise the bounding box is to render the lines as tubes.

Thanks

Edo
