How to apply PostProcessStage to a specific ImageryLayer?


Could you please help me to figure out how to apply PostProcessStage to a specific ImageryLayer?


Hi @bayanat_cesium,

I would help if you could describe the effect you’re looking to achieve. Do you have an example image or an explanation of the use case?


Hi @Gabby_Getz

There are an image layers on top of base layer. And I need to apply sharpen filter on specific image layer in same way as a contrast, brightness etc. PostProcessStage code from a documentation apply the changes for whole canvas including the space. As it works for a contrast it should be possible to apply in for a specifil layer, right?
(Cesium Sandcastle)

Hi @bayanat_cesium,

For contrast, brightness, and other similar adjustments, there’s no need to go through the post processing pipeline. These are properties of the ImageryLayer itself which you can adjust as shown in this example.

For sharpening the layer texture, I think this depends on the exact sharpening effect you’re looking to achieve. It may help to understand why you need the sharpening adjustment. There are texture layer filters available to adjust how the texture’s pixels are interpolated without post processing.

Hi @Gabby_Getz
Example of sharpening effect I’m looking to achieve you can see here (Cesium Sandcastle)

But basically I’m trying to find a way apply an any custom effect which may be necessary on-the-fly for a specific layer.

Thanks @bayanat_cesium,

Because of how the imagery system is implemented, where the globe itself is the primitive with one or more imagery textures rendered to it, I don’t believe it is possible to apply post processing to only one imagery layer.

Is it possible to use a primitive such as a rectangle to render the imagery? In that case you should be able to use per-feature post processing.

I was curious about the use case for sharpening the imagery in general, as there maybe an alternative approach to solve the problem.

Sometimes it’s needed to see more details on an image

Am I understand correctly that contrast, brightness, etc. are using some private post processing API that’s why they could be applied to the layer and a “custom” post processing works in different way?

Yes, if you wanted to apply something custom, take a look in GlobeSurfaceTileProvider.js. Uniforms are set in addDrawCommandsForTile, and corresponding shader updates can be added in GlobeFS.glsl.

Overall, sharpening an imagery layer does seem to be a widely applicable use case and I’m surprised it’s not already part of the API. Added a note to Allow for custom imagery adjustments · Issue #6449 · CesiumGS/cesium · GitHub to track this request.