ngageoint / opensphere

OpenSphere
Apache License 2.0
185 stars 90 forks source link

Adjusting brightness/contrast/saturation causes tile flickering in 3D mode #306

Open jsalankey opened 6 years ago

jsalankey commented 6 years ago

The ticket to support brightness/contrast/saturation in 2D mode added filtering methods that alter these values on tiles directly for 2D mode as it was not supported natively by Openlayers. Since that work was done, the same controls cause flickering in the tiles in 3D mode.

I'm guessing that the 3D mode tiles are being updated with the new filters instead of using the native Cesium methods for changing these values.

wallw-teal commented 6 years ago

That's correct. We felt that this was better because it maintains a single implementation that works in both OpenLayers and Cesium in addition to any other renderer plugin.

It's possible that the UI control could be throttled a bit if the change is expensive. However, it was not our intention to re-enable Cesium's internal methods for those filters. Despite the fact that they are faster (I thought they were implemented as shaders but I can't recall exactly), they still only need to run once when a tile is loaded. That negates the performance improvement during general application use and is really only an issue when changing the slider.

schmidtk commented 5 years ago

The flickering happens because the tile images are being modified outside of Cesium, which means textures need to be reloaded to the GPU. The Cesium controls adjust how the tiles are rendered in the shader, which only requires rendering a new frame with the existing texture.

If we want to completely fix the flicker, we'll have to use Cesium's controls again and make sure the 2D/3D implementations result in the same visual appearance. We could also make the flicker less annoying if the sliders weren't live, but that's obviously less responsive to the user while they adjust the values.