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 }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
changed the title [-]add support for "fill-image" and "background-image"[/-][+]"fill-image" fails when image >510px on either dimension[/+]on Oct 17, 2014
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.
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.
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.)
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.
Activity
jfirebaugh commentedon Oct 16, 2014
fill-imageis already supported. Are you seeing a specific issue with it?background-image: #394
[-]support for "fill-image" and "background-image"[/-][+]add support for "fill-image" and "background-image"[/+][-]add support for "fill-image" and "background-image"[/-][+]"fill-image" fails when image >510px on either dimension[/+]peterqliu commentedon Oct 17, 2014
After some tinkering, I've found the issue.
fill-imageworks 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
incanus commentedon Oct 17, 2014
Does it look ok in the sprite?
peterqliu commentedon Oct 17, 2014
@incanus yup
jfirebaugh commentedon Oct 28, 2014
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.
samanpwbb commentedon Sep 14, 2015
👍 for tripling the dimensions.
[-]"fill-image" fails when image >510px on either dimension[/-][+]Increase sprite atlas size beyond 512×512[/+]incanus commentedon Sep 14, 2015
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.
jfirebaugh commentedon Dec 9, 2015
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.)
1ec5 commentedon Jan 26, 2016
#3703 increases the SpriteAtlas size to 1024×1024.
samanpwbb commentedon Aug 5, 2016
I'm recommending users to create sprites that are
1360 × 400at@2xin 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: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.
[-]Increase sprite atlas size beyond 512×512[/-][+]Increase sprite atlas capacity[/+]