How to pick the value of attribute in the point cloud

Hi Cesium team,

I’m trying to style my point cloud with height attribute.

  defines : {
      "Height" : '${user data}'
  },
  "color": 'mix(color("blue"), color("red"), clamp(${Height}, 0, 1))'

However, it seems that it is not retrieving the height value so I want to debug the Height but I don’t know how.

${user data} here supposed to have the value in range 0-255, which I confirmed at CloudCompare.

Thanks,
Hiroshi

REF:

@sx_dev

Thank you for sharing this question with the community!

One quick thing that I am noticing - it looks like you are defining the variable "Height" yet referencing the variable Height. This might explain why the value is not being retrieved. I recommend trying the following code:

  defines : {
      Height : '${user data}'
  },
  "color": 'mix(color("blue"), color("red"), clamp(${Height}, 0, 1))'

If you take a closer look at the example that you provided, distance is referenced the same way in the define statement and in the color statement.

    defines : {
        distance : 'clamp(distance(${POSITION_ABSOLUTE}, vec3(4401699.414399114, 225012.6097161405, 4595431.437015289)) / 25.0, 0.0, 1.0)'
    },
    color : 'mix(color("yellow"), color("red"), ${distance})'

I am curious to hear your thoughts! As always, reach out if you have any more questions or updates.

-Sam

Thanks! I will try that on my side

I have tried your way but I was not able to solve.
Could you please check the data and see if you can see the same thing happening?

PilesDemo_HeightsInUserData.zip (1.1 MB)

@sx_dev

Upon investigating this further, I am realizing that there might be an issue with how you are accessing the point cloud data. A great first step would be to confirm that Height : '${user data}' is retrieving the values that you expect. Can you please start by investigating this? As always, let me know if you have any other questions or concerns.

-Sam