You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
raster-resampling has no effect on raster tiles (eg. nearest neighbor is still blurry) #7331
According to the documentation, when setting the raster-resampling paint property to nearest the raster tiles should have sharp pixels when over-zoomed.
Nearest neighbor filtering interpolates pixel values using the nearest original source pixel creating a sharp but pixelated look when overscaled
Also, when changing the raster-resampling paint property to linear the results should appear different.
Actual Behavior
When setting the raster-resampling paint property to nearest the raster tiles have blurry pixels when over-zoomed.
When changing the raster-resampling paint property to linear the results appear the same (blurry).
Screenshots with custom layer (not in demo)
Over-zoomed in QGIS
Over-zoomed in Mapbox GL JS with raster-resampling set to nearest
Over-zoomed in Mapbox GL JS with raster-resampling set to linear
Screenshots from demo
Original tile
Over-zoomed in Mapbox GL JS with raster-resampling set to nearest
It's passing in the render tests which run on Linux, and I can't replicate this on my Linux machine either, so certainly it being a Windows specific issue sounds plausible.
I can also confirm this issue. I validated that both MIN & MAG texture filters are set to NEAREST using the WebGL Inspector Chrome Extension. This only happens on Windows, no issues on macOS:
Instead of blur, we get rainbowy edges, as we remap grey scale colors of the original tile image.
I'm hitting this while implementing #12268, not only on Windows but also on MacOS VM.
This issue can be fixed on Mac by using Chrome flag --use-gl-desktop as introduced in #10389, however that causes a separate set of tests to fail with missing globe and inconsistent stars. (Same or similar test failures that led to #12090)
A likely related issue appearing In the same circumstances: icons appear to have incorrect resampling.
Has anyone found a solution to this issue? I've tried versions 1.6 and version 2.8 and in both cases "nearest" raster-resampling is not working on Windows. It works on Linux/iOS (including on Android).
Activity
mourner commentedon Sep 25, 2018
Interesting! Might be GPU-dependent? Here's how the example works for me on macOS:
Can you also try different browsers?
robhawkes commentedon Sep 26, 2018
Ah good question, I hadn't checked other browsers and machines yet.
Here are the results of a few tests:
Looks like Windows vs. MacOS / iOS more than GPU. Are you able to replicate it on a Windows machine?
mourner commentedon Sep 26, 2018
Hmm, I have no ideas why Windows wouldn't like the
NEARESTmag filter. Perhaps you could poke around the code and see if there are any clues? https://github.com/mapbox/mapbox-gl-js/blob/master/src/render/draw_raster.js#L48robhawkes commentedon Sep 26, 2018
Me neither, I'll see if I can find a moment to have a look and poke around.
If it helps, the Three.js examples using a nearest mag filter work as expected (pixellated) on Windows: https://threejs.org/examples/webgl_materials_texture_filters.html
andrewharvey commentedon Sep 26, 2018
It's passing in the render tests which run on Linux, and I can't replicate this on my Linux machine either, so certainly it being a Windows specific issue sounds plausible.
Scarysize commentedon Dec 4, 2018
I can also confirm this issue. I validated that both MIN & MAG texture filters are set to
NEARESTusing the WebGL Inspector Chrome Extension. This only happens on Windows, no issues on macOS:Instead of blur, we get rainbowy edges, as we remap grey scale colors of the original tile image.
Scarysize commentedon Dec 4, 2018
I did some digging, and from what I can gather, the problematic lines are here:
mapbox-gl-js/src/source/raster_tile_source.js
Lines 129 to 131 in 321a369
If commented out, everything looks fine on my side.
SnailBones commentedon Oct 28, 2022
I'm hitting this while implementing #12268, not only on Windows but also on MacOS VM.
This issue can be fixed on Mac by using Chrome flag
--use-gl-desktopas introduced in #10389, however that causes a separate set of tests to fail with missing globe and inconsistent stars. (Same or similar test failures that led to #12090)A likely related issue appearing In the same circumstances: icons appear to have incorrect resampling.

michaelagal commentedon Jul 12, 2024
Has anyone found a solution to this issue? I've tried versions 1.6 and version 2.8 and in both cases "nearest" raster-resampling is not working on Windows. It works on Linux/iOS (including on Android).