larsmaxfield / maplibre-gl-js

MapLibre GL JS - Interactive vector tile maps in WebGL2
https://maplibre.org/maplibre-gl-js/docs/
Other
0 stars 0 forks source link

Improve appearance of stretched NaNs (zeros) #12

Open larsmaxfield opened 2 months ago

larsmaxfield commented 2 months ago

Stretching/smearing occurs where NaNs (zeros) interface with real values: image

This is annoying and should be improved at least from a visual appearance.

One possible route could be to check for non-zero neighbors to determine if extreme stretching occurs at the shader fragment, and then coloring it differently if true. This could be transparent, black, or even coloring it with the neighboring value color, based on the colormap.

larsmaxfield commented 2 months ago

This is also a visual issue with hillshading, because the sharp discontinuities are shaded very heavily as they are essentially steep cliffs.

One solution is to have a new hillshade layer — "raking light" — which adopts the hillshade approach but additionally checks for NaNs (zeros) to determine how to shade. For example, when determining slope, it could checking the elevation. If zero (NaN), then the slope should be set to zero so that it doesn't get shaded.