Display points and surfaces of polydata

Hi,

I’m trying to display the vertices(points) of a mesh along with the polygons with vtk from a vtp file.

This is the code I’m using :

        actor.GetProperty().SetVertexVisibility(visibility)

It does not change the rendering at all.

I saw the SetRepresentationToPoints() function but it does not seem to also display polygons.

What am I missing?
Thanks for the help

Hi @Julien_Champagnol have you tried increasing the point size? actor.property.point_size = 10

Hi,

I tried this but this isn’t working :

actor.property.point_size = 10
AttributeError: 'vtkmodules.vtkRenderingOpenGL2.vtkOpenGLActor' object has no attribute 'property'

I’ve also tried this code :

actor.GetProperty().SetPointSize(10)

wich isn’t giving me any execution error but I’m not getting the desired output…

Okay, i didn’t know you were using old VTK.

Does the problem also occur with different mesh?

I also get the problem with other meshes, I’ve tried logging the point size that I just set and I get a correct programmatic output, but no correct behavior…

actor.GetProperty().SetPointSize(10)
print("GetPointSize", actor.GetProperty().GetPointSize(), flush=True)
GetPointSize 10.0

Also what do you mean by old version of vtk? I’m using 9.3.1 which is 4 months old?

Okay, here’s a strange suggestion:

actor.GetProperty().EdgeVisibilityOn();
actor.GetProperty().VertexVisibilityOn();
actor.GetProperty().SetPointSize(10);

If that works, my hunch is right. I’ve always thought there was a bug where the opengl polydata mapper only respected the vertex visibility setting when edge visibility is switched on. Let me know what you see. I think this is an easy fix.

VTK 9.4 was just released a few days ago but it’s release candidates have been out for some weeks now, so I thought you were testing those wheels. One of the features in that that is you can access member variables without using the Set/Get functions.

I get this output but no behavior change…

GetEdgeVisibility 1
GetVertexVisibility 1
GetPointSize 10.0

That’s good to know, thanks for the info!

What’s the output of

print(vtkRenderWindow().ReportCapabilities())

ReportCapabilities display id not set

Hi, i need more information to understand what’s causing this behavior. What does vtkRenderWindow().GetClassName() output? Whats the operating system? Do you have a physical display or is it in a headless configuration? What GPU are you using? Did you build the VTK python yourself? If so what cmake settings did you use? or is it from pypi?

vtk.vtkRenderWindow().GetClassName() vtkXOpenGLRenderWindow
OS => Ubuntu 22.04.5 LTS
It is physical display
GPU => NV167 / Mesa Intel® Xe Graphics (TGL GT2)
I installed it from Pypi

Thanks!

If i understand correctly, you’re able to render polygons and lines fine, but not points? It could be a driver issue. Can you share output of glxinfo -B? You can get that from sudo apt install mesa-utils

Okay so there was a bug in my test suite, sorry about that… :man_facepalming:

I get a different behavior with

actor.GetProperty().EdgeVisibilityOn()
actor.GetProperty().VertexVisibilityOn()
actor.GetProperty().SetPointSize(size)

But the points aren’t displayed without EdgeVisibilityOn() and VertexVisibilityOn()
This seems to be what you talked about earlier?

Yup, so that confirms it.

Great, at least the bug is identified!
Will this be fixed in 9.4?
Do I need to create an issue or comment on an existing one ?

Unfortunately, no. 9.4 is out the door and we cannot add any further bugfixes to it. The fix will have to go in the next release.

Yes! please create an issue at https://gitlab.kitware.com/vtk/vtk/-/issues/new with minimal python sample code.

Done!
https://gitlab.kitware.com/vtk/vtk/-/issues/19540