Skip to content

Support point cloud classifications

Sébastien Guimmara requested to merge 222-point-classification into main

This PR adds support for classifications in the 3D Tiles parser for .pnts tiles as well as the PointCloudMaterial.

image

Features

  • Display classifications by using MODE.CLASSIFICATION in PointCloudMaterial.
  • Classifications are stored in an array of 256 Classification objects in the PointCloudMaterial.
  • Classification colors can be dynamically changed at runtime (see example).
  • Classification can be toggled at runtime (see example).
const material = new PointCloudMaterial({ mode: MODE.CLASSIFICATION });

// Hide Buildings (classification #6)
material.classifications[6].visible = false;

// Change High vegetation (classification #5) color to red
material.classifications[5].color = new Color('red');

Implementation

If the .pnts batch table contains a classification attribute (the exact case is unimportant, as we convert it to lowercase), then the material enables support for classification.

The classification attribute (an unsigned integer) is used to retrieve the color and visibility from the Classification table.

The classification table

The first 3 component of each element in the table contains the color for the classification (R, G, B).

The fourth and last component is used as a boolean to filter the classification (1 = show the point, 0 = hide the point).

By default, the classification table contains the values 0 to 13 (ASPRS definition) with a color scheme taken from this page:

image

TODO

  • Make point cloud transparent to handle invisible classifications
  • Fix broken picking in classification mode
  • Handle point size of zero (using scale)
  • Upload the tileset to 3d.oslandia.com

Closes #222 (closed)

Edited by Sébastien Guimmara

Merge request reports