Skip to content

Raster tiles aren't perfectly crisp at integer zoom levels #4552

Closed

Description

@jaapster

I noticed that raster tiles are somewhat blurry when rendered in Mapbox and did some experimenting.

When at a discrete zoom level (e.g. 14) it appears as if the tiles are rendered slightly smaller than the original size in which they were retrieved from the tile service.

Tile as it was received by the browser:
screen shot 2017-04-06 at 15 50 45

Resulting image in the map:
screen shot 2017-04-06 at 15 50 55

Am I correct in assuming that a 256x256 tile is not rendered in 256x256 pixels when at a discrete zoom level?

Once you notice the blurriness of the raster images it is rather annoying.

I'm using version 0.34.0

Activity

  1. Tijgerkracht commented on Apr 6, 2017

    @Tijgerkracht

    Have done some testing as well...and found rendering at level 20 of some google tiles seems to be sharp, while level 12 is quite blurry...this screenshot shows the image zoomed in a lot...
    Green is level 20, red is level 12
    afbeelding

  2. jfirebaugh commented on Apr 6, 2017

    @jfirebaugh
    Contributor

    I can't reproduce this. At a discrete zoom level, 256px raster tiles are rendered at exactly 256px, with no blurriness. Are you sure you don't have a page zoom factor in effect?

  3. jaapster commented on Apr 6, 2017

    @jaapster
    Author

    The page is at 100%.

    I'm having trouble reproducing the size difference at the moment, but the blurriness is still there.

    Original
    screen shot 2017-04-06 at 16 55 31

    Map
    screen shot 2017-04-06 at 16 56 15

    The map is at zoom level 14.

  4. jaapster commented on Apr 6, 2017

    @jaapster
    Author

    I can't reproduce the size difference anymore. I'm not sure what happened there.

    Another example of the difference between the original image and how it's rendered at zoom level 18:

    Original
    screen shot 2017-04-06 at 17 04 32

    Map
    screen shot 2017-04-06 at 17 05 08

  5. mourner commented on Apr 6, 2017

    @mourner
    Member

    @jaapster are you looking at this on a Retina screen? One guess I have is that browsers apply high-quality upscaling algorithms for displaying 2x-scaled images on the screen, while a OpenGL would do a low-quality bilinear interpolation.

  6. jaapster commented on Apr 6, 2017

    @jaapster
    Author

    @mourner I am looking at this on a Dell Ultrasharp U3415W monitor hooked up to a MacBook pro (2015). Some of my teammates that use PC's are experiencing the same results.

  7. mourner commented on Apr 6, 2017

    @mourner
    Member

    I'm also wondering whether #4443 could have any effect on this. Could you try this on the master version (not released yet) and see if raster tiles look the same?

  8. jaapster commented on Apr 7, 2017

    @jaapster
    Author

    Hi @mourner, I tried it on a build of master and the result is about the same

    Original
    screen shot 2017-04-07 at 13 23 19

    As rendered on the map
    screen shot 2017-04-07 at 13 23 37

    Still blurry

  9. andrewharvey commented on Apr 7, 2017

    @andrewharvey
    Collaborator
  10. Tijgerkracht commented on Apr 7, 2017

    @Tijgerkracht
  11. jaapster commented on Apr 7, 2017

    @jaapster
    Author

    @Pat28 I meant the result shows about the same blurr as I've seen in v0.34.0.

  12. andrewharvey commented on Apr 8, 2017

    @andrewharvey
    Collaborator

    Tagging this as a bug since we have multiple people noticing the same issue that for an unscaled page (100% zoom) at a discrete zoom level raster tiles are rendered blurry (compared to the raster tile downloaded / stored in the webgl texture; I inspected the texture with WebGL Inspector and it's crisp compared to the rendering).

    In this tile, I split on the left whats rendered and on the right what's in the texture/downloaded webp (split through the Boise label).
    tile-compare

    It happens with satellite too but it's less noticeable.

    Interestingly on a device with a devicePixelRatio of 2.25 I don't notice this issue, it looks crisp but on a device with devicePixelRatio of 1 I do. However on the devicePixelRatio of 1 device, if I force using @2x tiles I notice it's still blurry. So appears to be environment specific.

    This seems to go back to very early in GL JS versions.

  13. changed the title [-]Raster tiles always rendered somewhat blurry[/-] [+]Raster tiles aren't perfectly crisp at integer zoom levels[/+] on Sep 27, 2017
  14. ibesora commented on Oct 25, 2017

    @ibesora
    Contributor

    Is there an estimation about when will this issue be resolved? We were evaluating MapboxGL to change Leaflet in our map building web app but are facing this same issue, all the raster tiles are much more blurry than on Leaflet to the point of being unusable.

  15. emreibis commented on Nov 17, 2017

    @emreibis

    Can this issue be set to an higher priority because we do use a lot of raster tiles in our project?

  16. andrewharvey commented on Nov 20, 2017

    @andrewharvey
    Collaborator

    Not related to this issue, but just in case anyone searches for blurry tiles and ends up reading this issue, make sure if you're using 256px tiles you have set tileSize: 256 on your source, as that would also cause blurry tiles.

  17. andrewharvey commented on Jan 22, 2018

    @andrewharvey
    Collaborator

    closed by #6026. Great work @kkaefer 🎉

  18. gabimoncha commented on May 23, 2018

    @gabimoncha

    Hi, @andrewharvey @kkaefer @jfirebaugh

    I have the same problem. Just started a project in mapbox-gl and using it with react (no wrapper)
    I created the style in the studio, but the raster which is a .tif file when added as a layer gets blurry. Also, in the browser they look the same. If I am doing something wrong please tell me. In case it's not the package's fault, can you direct me to some place where this question should be asked?
    Here are the screenshots:

    .tif file:
    image

    in the studio:
    image

    Can you help me solve this problem. If you have questions please do ask

  19. andrewharvey commented on May 23, 2018

    @andrewharvey
    Collaborator

    @gabrielmoncea do you think your issue is #4450? There is a proposed fix for that at #6411 but it hasn't been merged into a release yet.

  20. kkaefer commented on May 23, 2018

    @kkaefer
    Member

    @gabrielmoncea how are you adding the TIFF file? Mapbox GL can't natively read TIFF files, so there's a good likelihood that one of the intermediary steps introduces these artifacts as well.

  21. gabimoncha commented on May 23, 2018

    @gabimoncha

    @kkaefer I uploaded the files as GeoTIFFs. sorry my bad.

  22. riastrad commented on May 24, 2018

    @riastrad

    @gabrielmoncea How are you preprocessing the GeoTiff prior to uploading it as a Tileset? The upload pipeline sometimes has trouble with unusual (anything not 256px) block sizes and this can cause the tiles to be be blurry, but you can usually get around this by specifying the GeoTiff's block size prior to uploading.

    For example, using GDAL via the command line you can run a command similar to the following:

    gdal_translate -co BLOCKXSIZE=256 -co BLOCKYSIZE=256 input.tif output.tif
    
  23. gabimoncha commented on May 26, 2018

    @gabimoncha
  24. riastrad commented on May 30, 2018

    @riastrad

    @gabrielmoncea for large GeoTiff files we recommend a block size of 256x256.

    See: https://www.mapbox.com/help/uploads/#tiff-uploads

  25. mathieurudaz commented on Aug 7, 2021

    @mathieurudaz

    I have the exact same problem and even after executing
    GDAL_Translate -of GTIFF -ot BYTE -scale 0 1 0 255 -co TILED=YES -co BLOCKXSIZE=256 -co BLOCKYSIZE=256 -b 1 -a_nodata 0 input.tif output.tif my raster is blurry in Mapbox studio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions