Cesium: Nearest-neighbor image resampling for ImageryLayer

Created on 27 Sep 2017  路  9Comments  路  Source: CesiumGS/cesium

We develop an application that uses Cesium to display climate data imagery. Many users (usually Earth scientists) would like to see the original grid cell extends in the images. Cesium seems to use (linearily) interpolated textures by default. Is there any possibility to set an ImageryLayer to a nearest-neighbor image resampling so actual grid cells would be displayed as squares? Even a global Cesium (or WebGL) setting would help.

To get an idea, here is a screenshot of the application showing monthly cloud averages in 0.5 degree grid cells. The interpolation applied makes it impossible to distinguish the original grid cells:

image

All 9 comments

Hi there @forman. Please ask your question over at the Cesium Forum. Cesium's a big project, so we use GitHub for feature requests and bug tracking exclusively. Thanks!

@lilleyse confirmed that there's not a way to do this is Cesium currently. The imagery layer has the linear interpolation hard-coded, so we'll leave this open.

I think we had a thread about this at one point on the forum and it's come up before. @bagnell isn't modifying this just a one line change? Might be a good workaround or easy enough for someone to open a PR to handle.

Hi @ggetz, sorry for spaming your issue tracker and thanks for the info! Maybe @lilleyse could point me to the code location so we may fork & fix.

@mramato we're happy to do so

You can add Samplers to the textures here:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/ImageryLayer.js#L743

Set the minification and magnification filters to NEAREST. If the textures need reprojection, you can modify the samplers here:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/ImageryLayer.js#L796

Thanks @bagnell! Looking forward to a pull request @forman! Let us know if you run into any roadblocks.

@bagnell thanks, I hope to find some time next week for a PR.

Yeeha:
image

Closing this as the feature is already included since v1.39, 2017-11-01.

Was this page helpful?
0 / 5 - 0 ratings