`bevy_image::TextureAtlasBuilder`: Symmetric texture atlas padding
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
The `TextureAtlasBuilder` and `DynamicTextureAtlasBuilder` builders pack padded images asymmetrically, with padding only added to the bottom and right edges. As a result, images that are positioned at the top or left edges of the atlas are flush against the atlas boundary, with no padding on those sides.
This can result in inconsistent rendering behavior that depends on where the packer placed the image in the atlas.
## What solution would you like?
An option to reserve intial padding on the top and left edges of a texture atlas. Currently with `TextureAtlasBuilder` with padding set to `2`, the first image you add to a texture atlas will be placed with its top-left corner at position (0,0). Instead, with this option, it would be placed at position (2, 2).
I think symmetric padding should probably become the default behaviour, I'm not certain though. We could add this feature first, then decide on the most desirable default after.
Contributor guide
Research direction
Start from the TextureAtlasBuilder and DynamicTextureAtlasBuilder implementations and trace how padding is applied while images are packed. Define how an option reserves the initial top and left padding, verify the first image starts at the requested offset, and resolve whether symmetric padding should become the default.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, game-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100