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
What problem does this solve or what need does it fill?
You have two sprite sheets
16 16x16 sprites
4 32x32 sprites
For both convenience and performance, you would like to load the two sprite sheets individually and then have Bevy combine them into a single texture atlas. But unfortunately, Bevy only supports loading homogeneous sprite sheets from a single source image.
What solution would you like?
A method that allows you to take two (or more) sprite sheets and combine them into a single texture atlas:
It no longer works since 0.11 changed the visibility of the texture handles field to pub(crate). This wouldn't be a problem if it's added to the bevy_sprite crate.
It only merges already existing texture atlases. This means that to create the texture atlas in my example above you would have to generate two intermediate texture atlases from the sprite sheet images to pass into merge_atlases, which isn't ideal.
A more ambitious implementation could chop up the sprite sheets and then add the sprites individually into a TextureAtlasBuilder. This would allow you to add padding to unpadded source sprite sheet images and might reduce the size of the output texture atlas.
The text was updated successfully, but these errors were encountered:
I wanted to use either guillotiere or etagiere for general texture -> texture atlas preprocessing, not just for sprites / sprite sheets. Discussed this a bit with nical (Mozilla dev working on UI stuff as far as I know) on Discord in the Atlas allocation thread in #rendering-dev https://discord.com/channels/691052431525675048/1152646466788134912
Ah yeah, those both look good. I wrote some utilities for manipulating texture atlases last year for a 2D game I was working on but they didn't run during gameplay so performance didn't really matter.
The way we handle font texture atlases in Bevy is really terrible, maybe guillotiere could help?
At the moment for each font, we have a font-size -> TextureAtlas hashmap. There is no scaling or anything, we store a separate texture atlas for each distinct font size even if the difference is a millionth of a pixel. These are all retained in memory forever until the font asset is dropped. A naive system that adjusts the size of a text's font to match the width of a window so that it always fills 50% of the available space will add dozens of new texture atlases to the font set every time you change the size of the window until WGPU panics with a Not enough memory left error.
We want all the glyphs with the same font and font size to share the same atlas obviously but maybe with guillotiere we could dynamically insert and remove multiple sets of glyphs from different fonts together into single atlases.
I've avoided tackling any of this because I don't have that much experience with rendering and the UI and text systems always have new non-rendering issues for me to work on.
What problem does this solve or what need does it fill?
You have two sprite sheets
16 16x16 sprites
4 32x32 sprites
For both convenience and performance, you would like to load the two sprite sheets individually and then have Bevy combine them into a single texture atlas. But unfortunately, Bevy only supports loading homogeneous sprite sheets from a single source image.
What solution would you like?
A method that allows you to take two (or more) sprite sheets and combine them into a single texture atlas:
Rough sketch of a possible API:
Prior art: I wrote this function a while that merges multiple existing texture atlases:
It has problems though:
pub(crate)
. This wouldn't be a problem if it's added to the bevy_sprite crate.merge_atlases
, which isn't ideal.A more ambitious implementation could chop up the sprite sheets and then add the sprites individually into a
TextureAtlasBuilder
. This would allow you to add padding to unpadded source sprite sheet images and might reduce the size of the output texture atlas.The text was updated successfully, but these errors were encountered: