Improved sprite filtering
- 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?
I've made a new shader for bevy_sprite that improves texture filtering.
This improves:
* jitter/distortion when scaling
* aliased edges when rotating
* fixes the edge bleeding present in texture atlases
I'm changing the texture sampler manually, but how do I change the default texture sampler for sprites/ColorMaterial? I need to set mag_filter to linear, but this is difficult to do because samplers are tied to textures.
## What solution would you like?
Textures and samplers should be decoupled. While textures are only useful when paired with a sampler, this assumes that entities sharing the same texture also want to share the same sampler.
This also allows for sampler reuse (#5), when a sampler isn't present we can use the default default sampler.
## What alternative(s) have you considered?
The demo below uses a system to modify sprite entity textures when they are created. However, this is not ideal because entities have different textures. Two copies of the same texture and texture atlas assets are required just to change their sampler!
## Additional context
Demo for texture atlas scaling. (my implementation is on the left)
https://user-images.githubusercontent.com/91480720/138690070-d5aa51cd-a628-4a14-8d59-90b5a0c382d7.mp4
Sprite rotation aliasing:

Contributor guide
Research direction
Start by reading the bevy_sprite and ColorMaterial entry points involved in sprite textures, samplers, and texture atlases. Review how the current sampler is selected and compare it with the linked filtering demo. Done means sprites can use reusable, independently selected samplers without requiring duplicate texture or atlas assets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100