ColoredElevationMap speed

I’ve been searching the interwebs for the past days (3-4) but I cannot find a solution to my problem. I want to color a pointcloud of about 40 million points by height, I took a look into the ColoredElevationMap example but it’s way to slow, basically it crashes before finishing, after a minute or so.

What could be done? I am new to all this.

This takes ~40s on my system:

from vtkplotter import *
from random import uniform as u
N = 4000000
rgb = [(u(0, 255), u(0, 255), u(0, 255)) for i in range(N)]
pts = Points(rgb, c=rgb, alpha=1, r=1)
show(pts, bg="white")

Internally it uses the vtkVertexGlyphFilter:

        src = vtk.vtkPointSource()
        vgf = vtk.vtkVertexGlyphFilter()
        pd = vgf.GetOutput()

        ucols = vtk.vtkUnsignedCharArray()

        for i in range(len(plist)):
            ucols.InsertNextTuple3(c[0], c[1], c[2])

        pd.GetPoints().SetData(numpy_to_vtk(plist, deep=True))

Even 40 seconds is too much… I need it to be less than 0.5secs to be acceptable


What do you expect to take 0.5sec? Rendering time may be much shorter than that. However, you need to start the application, load data, perform initialization, etc. and you cannot expect to complete all these within half second.

I got to color the points using glsl.
But rendering of 7M points takes about 4 seconds, I am talking about renderWindow->render(), which is quite slow, since the actor (or the actor data) will be changing every ~3-5 seconds.
To render the data I pass the data though a vtkVertexGlyphFilter and then vtkOpenGLPolyDataMapper.

The whole ordeal is running on an Integrated Intel HD630 and having more powerful hardware is not an option…

Any ideas?

If you have hardware that is so underpowered for the task, then you have to implement very smart software to reach your performance goals.

I would recommend trying hardware-accelerated using vtkGlyph3DMapper and/or level-of-detail (LOD) rendering. If you are stuck with an integrated graphics card then it may be still too slow. Frequent full updates may be challenging, too. Starting with performance profiling could help you identifying bottlenecks then focus on resolving those.