Precision of POSITION_ABSOLUTE point attribute for 3D Tiles styles for point clouds

Hi!

1. A concise explanation of the problem you’re experiencing.

I’m visualizing 3D point clouds with Cesium and would like to visualize a height gradient (something like this: https://user-images.githubusercontent.com/3269617/33374948-e5173068-d510-11e7-9ef5-2df7b4833f74.png).

I am trying to accomplish this using 3D Tiles styles based on the POSITION_ABSOLUTE attribute.

When tinkering around with approximations for the point-to-ellipsoid distance problem, I noticed that there are visible artifacts in the gradient I’m getting.

This makes we wonder: What is the precision of the POSITION_ABSOLUTE attribute of a point? It seems like the precision used in styling is much lower than the precision used for placing the point. Or am I missing something else entirely?

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

See here for an example based on the “3D Tiles Point Cloud” sandcastle example.

In this example, I color points based on the fractional part of the z-axis component of the POSITION_ABSOLUTE attribute. What I would expect is a rather smooth greyscale gradient along some tilted axis (as the z-axis is not ‘up’). The visualization however shows basically two colors: Black and grey. This tells me that all points have a precision of not even one fractional digit?!

This is the same for the x-axis component. For some reason, the y-axis component seems to provide better results in the example.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

If there is a better way to visualize a height gradient of the point cloud, I’m interested. However, I’d rather avoid pre-calculating (and storing!) that attribute for every point for all data sets that we have.

4. The Cesium version you’re using, your operating system and browser.

Sandcastle currently uses Cesium 1.62, I’m using Arch Linux and Firefox 69. I also reproduced the problem on a Windows 10 machine with Chrome.

1 Like

This is where the position_absolute is computed in the shader:

Notice that it’s possible position_absolute has less precision than is used to place the point in the right location on the globe, because the point’s location is split into the RTC_CENTER and its position relative to that.

Also, in case others find it useful, here’s a Sandcastle that styles the points by distance relative to a given point. The point is computed by clicking somewhere and copying the console output into the shader.

thanks,and how i adjust opacity base on color, the code below is not run
new Cesium.Cesium3DTileStyle({
color:‘vec4(${COLOR},0.8)’
});

Styling with transparency should work, there’s some examples of this here: https://sandcastle.cesium.com/index.html?src=3D%20Tiles%20Point%20Cloud%20Styling.html