-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished
Description
Bevy version
0.15.0
What you did
When ImageFilterMode::Nearest
is set as the default sampler, tearing occurs to text, sprites, etc. when the window resolution is an odd number (101x303
, etc.). You can test by spawning a sprite and then resizing the window:
use bevy::prelude::*;
fn main() -> AppExit {
App::new()
.add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()))
.add_systems(Startup, setup)
.run()
}
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2d);
commands.spawn(Sprite::from_image(asset_server.load("grid_480x270.png")));
}
The notable exception is that it doesn't happen to sprites with dimensions that is the power of two (512x256
, etc.).
You can test a more elaborate, interactive reproduction here: https://github.com/musjj/nearest_filter_bug. Slowly and gradually resize the window and you should be able to see the artifacts popping in and out.
What went wrong
Visual tearing occurs.
Additional information
An example of no tearing:
An example of tearing:
A closeup of the tearing (the lines are supposed to be perfectly straight):
solson
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished