0

How to Implement a PointCloudSeries for Large, Static Point Cloud Data

Patrick Stalph 3 years ago • updated 4 weeks ago 4

First off, Oxyplot is an amazing project - open source, high quality, MIT, tons of samples, even documentation :-) It covers many interesting use cases for me, but I hit one particular problem:


In WPF the pan/zoom performance is bad on large data sets (e.g. ScatterSeries with 100000 points). This is expected, of course, because of the rich interactiveness a ScatterSeries provides; no criticism. I experimented with various settings, also checking the performance guidelines (ScatterSeries, MarkerType=crosses seems to be best currently), but the result was not sufficient.


Use Case

In the following screenshot you see

  1. White dots: about 90000 points from a laser scan
  2. Various line drawings on top


Goal

Implement a high performance oxyplot "Series" for large point clouds.

  • The point cloud is static, initial loading time is less relevant
  • A data point has x, y, color (or at least grayscale)
  • The user can pan and zoom to investigate different areas - fast.
  • Not sure about the tracker, yet.

Question

What's the best way to achieve this? Looking at the samples, I found that PolarHeatMapSeries has an image-based rendering mode, which allows for fast pan/zoom. There were some image annotations, too. Any directions are welcome. I'm willing to contribute, if it works out well.

I managed to render onto an image following the PolarHeatMapSeries example. Current results are kind of disappointing, order by performance:

  1. Standard ScatterSeries with binsize 2, plus markers of size 0.75 has mediocre performance (~15 FPS). However, it does not look right: crosses are not points, binsize 2 creates scattered view independent of zoom.
  2. Custom implementation looks like a laser scan point cloud, but pan/zoom performance is worse (~7 FPS on a recent gamer machine). No custom binning used so far. There would be a lot of overlap on standard zoom levels (or little to draw with high zoom).
  3. Circles with binsize 2 are slower (as the documentation advertised).
  4. Without binsize all breaks down. 2-5 seconds per frame.

I can see two options from here:

  • Implement custom bin reduction in my custom series, via kd-tree (?) Have to check, how oxyplot does this bin magic.
  • Implement custom "point" marker. Not sure how much performance gain is possible when drawing just a line of minimalistic length instead of two lines (cross / plus)

<please insert your terrific idea here> :-)


PS: OxyPlot ist still amazing for all other use cases. Great MVVM pattern in the WPF libraries.

Ok, checking the current rendering code of the ScatterSeries, there seems to be a lot of room for tuning when moving from "all-purpose" towards "tailored for many points". I guess, a custom implementation that strips the ScatterSeries to a bare minimum might be a good third option.

Talking to myself here :) Lets call it documentation.


Stripping the ScatterSeries to a minimum did help a little (but not worth the effort). The major impact was moving from two lines drawn per data point (plus marker) to one line of length 1, width 1. Cutting the WPF objects to half indeed boosts the performance significantly.


Custom rendering onto an image still looks best. However, more work has to be done for hyper efficient data retrieval (backing spatial tree structure to quickly cut the clipping rectangle out of the data).

The .Net Framework v4.7.2 has a WriteableBitmap class that allows high-performance rendering (90000 points fullscreen in 5ms). Such performance allows for smooth zoom/pan operations. As there was no interest at all, I'll implement this in my own library - just wanted to let others know that WriteableBitmap is an interesting alternative.