Fast 3D point cloud animation

I want to visualize a polyData object of type vtkPolyData as a 3D point cloud and update it in an animation. The size, opacity, and the color of each point should be linked to the magnitude which is set as polyData->GetPointData()->SetScalars(magnitude), where magnitude is a vtkFloatArray.

I found several examples where the points are converted to a 3D glyph, e.g., a sphere. However, I would prefer something simpler than that, e.g., just a round vertex.

Long story short, I want to adapt the example such that the vertex is a circle instead of a square, and the size, opacity, and color should be linked to the magnitude.

Is this possible or do I have to use glyphs?


Try using vtkOpenGLSphereMapper ( as your mapper instead of the more generic vtkPolyDataMapper mapper. It’ll draw your points as fake spheres (not glyphs).



Thank you, I was looking for something like this. However, I would like to disable the shader on the fake spheres such that each sphere has a single color. Also, is it possible to set the opacity of each individual sphere using an array?

Unfortunately I couldn’t find any examples in the internet. I think you’re better off by reading about the parent class vtkOpenGLPolyDataMapper ( I guess you can write a shader for the fake spheres such that opacity (alpha channel) is set from a scalar value present at each point. This example (GitHub - dmreagan/vtk-shaders: Simple example of using shaders with VTK) introduces you on how to write shaders to use with vtkOpenGLPolyDataMapper (parent of vtkOpenGLSphereMapper). From there you can experiment by trial and error to achive the effect you want.