Glyph3D filter but acting on polydata Vertices rather than points

Hi, is there a way to make the vtkGlyph3D filter acting on the Vertices (cells) of a polydata rather than the points ?

I have a polydata with cells being triangles, lines, and vertices. I want a pipeline where I put tubes in place of lines (the tube filter works well) and spheres in place of vertices but the glyph3D filter works on the points of the polydata so it’s not what I want…

It is not really clear to me what you want. First of all, you have the option to render lines as tubes and points as spheres simply by using the property of the actors. If you want spheres on only some of the points, you could split your data into two and use multiple actors. Also, the vtkGlyph3D as well as the vtkGlyph3DMapper can be used in conjunction with SetInputArrayToProcess, where you can specify what primitives to target.

Oh, I didn’t know about this ! It’s definitely simpler than my solution but sadly the tubes and spheres have not a fixed width, it changes whenever you zoom… Is there a way to fix this ?

To add clarification, I want to render an actor based on a polydata with different types of cells:

  • triangles
  • polylines
  • vertices
    But I want to render the polylines of the polydata as tubes to give them a real width, and the vertices as spheres for the same reason. (+ I want to be able to set the color of each cell but that’s ok)

Ideally I’d like something that looks like that https://www.kitware.com/rendering-tubes-and-spheres-in-vtk/ , on my polylines and vertices.But the solution in that link and yours do not have an “absolute” width, but one which adapt to the camera.

EDIT: also, another thing I’d like to do is to pick cells. With the solution of rendering lines as tubes in the actor, I can’t pick the tubes or spheres

If it was me, I would split the vtkPolyData and use multiple actors.

That is what I did first, but it leads to thousands of actors and my computer doesn’t like it…

Not one actor per vert. One actor for all the verts. For example vtkExtractCellsByType can extract the verts into a separate dataset, and you can then put this dataset into vtkGlyph3D.

Or, if you want, you can use vtkAppendPolyData to combine the output of vtkGlyph3D and the output of vtkTubeFilter and use just one actor for everything.

1 Like