Color Point Cloud based on elevation

I’m trying to style the point cloud based on elevation. I’m guessing the elevation can be represented by the per point attribute ${POSITION}[2]?

When I do this, it does change the color of most points under 60, but it also color some points above 60 (e.g. top of buildings). Maybe I’m missing something here?

pointCloudTileset.style = new Cesium.Cesium3DTileStyle({
  color: {
    conditions: [
      ["${POSITION}[2] < 60", "color('#7A0403')"],
      ["true", "color('#FFFFFF', 1.0)"],
    ]
  },
});

Here’s the sandcastle that I’m currently working on

POSITION is in model coordinates.

You could use POSITION_ABSOLUTE, which is in world coordinates, and calculate the distance to the ground per point. Keep in mind that POSITION_ABSOLUTE might suffer from precision loss.

1 Like