CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.86k stars 3.47k forks source link

Add per feature post processing to an entire 3D Tileset #6657

Open bagnell opened 6 years ago

bagnell commented 6 years ago

Per feature post processing only works on individual features of a tileset. It woul be nice if it worked on an entire tileset.

See https://github.com/AnalyticalGraphicsInc/cesium/pull/6476#issuecomment-388381350

OmarShehata commented 5 years ago

This just came up on the forum. In this case, the tileset has no features. Since we now consider tilesets that don't have any features to implicitly all be one single feature (https://github.com/AnalyticalGraphicsInc/cesium/pull/7255), this may be easier to do now.

ProjectBarks commented 5 years ago

From what I read in Cesium3DTileset.js this does not seem achievable without a large overhead. Since each tile is given its own pickId you would need to first recursively get all pickIds, then add them to the PostProcessingStageCollection.

Where it gets complicated is if any tiles unload/load back in; you would need to reflect those changes in the PostProcessingCollection. Managing that list of loaded/unload tiles would become burdensome. I think someone could implement this via existing API (without a cesium change) but certainty would be beneficial.

ProjectBarks commented 5 years ago

If I were to go about solving this here is how I would do it:

  1. Make selected work on a wider set of cesium features. I know Models work but primitives, and entities do not. This is a consequence of their API's not exposing their pickId as a private property of their class. Fixing this would provide continuity over the post processing library.
  2. Make the .selected property of PostProcessingCollectionprovide inclusive and exclusive filtering. Currently post processing shaders will do one of three things: not respond at all _(the majority do this)_, filter selected inclusively, or filter selected exclusively. Because of the lack of consistency it makes it unclear what shaders work with the selected properties and which ones do not. Perhaps we have.selectedand.selectedMode: inclusive, exclusive`.
  3. Add 3D tileset support. Which would work as follows:

From what I read in Cesium3DTileset.js this does not seem achievable without a large overhead. Since each tile is given its own pickId you would need to first recursively get all pickIds, then add them to the PostProcessingStageCollection.

Where it gets complicated is if any tiles unload/load back in; you would need to reflect those changes in the PostProcessingCollection. Managing that list of loaded/unload tiles would become burdensome. I think someone could implement this via existing API (without a cesium change) but certainty would be beneficial

OmarShehata commented 4 years ago

Came up again over email. Here the 3D Tileset was an individual building that they were trying to highlight with an outline over mouse over.

Frank-Chan commented 3 years ago

Came up again over email. Here the 3D Tileset was an individual building that they were trying to highlight with an outline over mouse over.

Any solutions there?

cognitiveplus commented 3 years ago

Hey guys, is it still not possible? I would want to apply custom color correction shader to custom tiles, but using czm_selected() and stage.selected = [cesitum3DTileset] simply doesn't do anything.