Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Increase sprite atlas capacity #489

Closed

Description

@peterqliu

"fill-image" fails when image >510px on either dimension

Activity

  1. jfirebaugh commented on Oct 16, 2014

    @jfirebaugh
    Contributor

    fill-image is already supported. Are you seeing a specific issue with it?

    background-image: #394

  2. changed the title [-]support for "fill-image" and "background-image"[/-] [+]add support for "fill-image" and "background-image"[/+] on Oct 17, 2014
  3. changed the title [-]add support for "fill-image" and "background-image"[/-] [+]"fill-image" fails when image >510px on either dimension[/+] on Oct 17, 2014
  4. peterqliu commented on Oct 17, 2014

    @peterqliu
    ContributorAuthor

    After some tinkering, I've found the issue. fill-image works reliably up til the image is 510px in either dimension. Beyond that and it will not render.

    In this example, the water pattern is sized at 510x510, and shows on both browser and native. However, the forest pattern (greenish one over land) is 510x511, and does not show on native.

    cc/ @jfirebaugh @incanus

  5. incanus commented on Oct 17, 2014

    @incanus
    Contributor

    Does it look ok in the sprite?

  6. peterqliu commented on Oct 17, 2014

    @peterqliu
    ContributorAuthor
  7. jfirebaugh commented on Oct 28, 2014

    @jfirebaugh
    Contributor

    The sprite atlas has a hard-coded size of 512x512, and images are padded by 2 pixels on a side, so 510 is indeed the current magic number.

    In order to fix this properly we need to auto-grow the atlas size when it overflows. A quick fix would be double or triple the current dimensions.

  8. samanpwbb commented on Sep 14, 2015

    @samanpwbb
    Contributor

    👍 for tripling the dimensions.

  9. changed the title [-]"fill-image" fails when image >510px on either dimension[/-] [+]Increase sprite atlas size beyond 512×512[/+] on Sep 14, 2015
  10. added
    GL JS parity
    on Sep 14, 2015
  11. incanus commented on Sep 14, 2015

    @incanus
    Contributor

    There are GL texture implications here to which @kkaefer or @adam-mapbox could likely speak. We need to go with a safe, conservative max texture size across iOS and Android.

  12. jfirebaugh commented on Dec 9, 2015

    @jfirebaugh
    Contributor

    triple the dimensions

    I've since learned that we can't increase the size beyond 1024x1024 without changing how sprite alas coordinates are packed in vertex attributes. (Icons are aligned to multiples of 4 pixels, each coordinate is divided by 4, packed into a single byte, and multiplied by 4 in the shader.)

  13. 1ec5 commented on Jan 26, 2016

    @1ec5
    Contributor

    #3703 increases the SpriteAtlas size to 1024×1024.

  14. samanpwbb commented on Aug 5, 2016

    @samanpwbb
    Contributor

    I'm recommending users to create sprites that are 1360 × 400 at @2x in this tutorial: https://www.mapbox.com/blog/location-based-game-map/, which may be the cause of why maps made with this tutorial are rendering incorrectly:

    2016-08-05 10 47 21

    If we want to take textures serious we need bigger sprite atlas sizes. 1024 x 1024 is not enough space. Even in the tutorial, the textures feel too small (ideally each individual fill texture is 512 x 512 to reduce how much repetition is apparent to the user.

  15. changed the title [-]Increase sprite atlas size beyond 512×512[/-] [+]Increase sprite atlas capacity[/+] on Sep 27, 2016
  16. added
    Core
    and removed on Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreGL JS parity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions