cesium icon indicating copy to clipboard operation
cesium copied to clipboard

Supporting picking properties from property textures

Open sanjeetsuhag opened this issue 3 years ago • 4 comments

Unlike Feature ID attributes and Feature ID textures, Feature Textures present a challenge for implementing picking because both the attribution and the metadata is on the GPU side, in the texture.

An initial, and admittedly flawed, approach to picking certain values from feature textures was accomplished by exploiting how the pickColor is generated, with the rgba channels populated from left-to-right, with each channel accounting for 32768 pickable objects. The feature ID texture values were sampled (by modifying the pickId) and encoded in the unused (arbitrarily set to b and a) channels, and PickFramebuffer.js was modified to extract those values.

A more stable approach would be to add a pickFeatureTexture() function to Scene.js:

  1. This function would first call pick, check if the object returned has the requested feature texture.
  2. The primitive's pickId would be modified to sample the values from the feature texture.
  3. The draw commands would be updated.
  4. pick would be called again, and values would be read from the channels specified by the feature texture
  5. The pickId would be reset back to czm_pickColor
  6. The draw commands would be updated

CC: @lilleyse @ptrgags

sanjeetsuhag avatar Oct 05 '21 14:10 sanjeetsuhag