The general principle is that vtk objects have a lot of overhead, so for performance rendering you want to pack as many items as possible on one object as much as possible. When you call mlab convenience functions such as points3d , it creates a new vtk object to process this data. Thus, iterating and creating thousands of points as vtk objects is a very bad idea.
The trick of temporarily disabling rendering, as in this other question, the βrightβ way to do this is to have one VTK object that contains all the different points.
To set different points in different colors, give scalar values ββto the vtk object.
x, y, r = np.random.random ((3,100)) some_data = mlab.points3d (x, y, g, = Colormap 'cool') some_data.mlab_source.dataset.point_data.scalars = np.random.random ( (100))
This only works if you can adequately represent the color values ββthat you need in the color palette. This is easy if you need a small finite number of colors or a small finite number of simple color palettes, but very difficult if you need completely arbitrary colors.
source share