Texture Filtering Default Inconsistency
Bevy version: 0.12.0
Relevant system information:
CPU: Ryzen 9 7950X GPU: Radeon RX 7900 XTX Memory: 32 GB DDR5
If your bug is rendering-related, copy the adapter info that appears when you run Bevy: `AdapterInfo { name: "AMD Radeon RX 7900 XTX", vendor: 4098, device: 29772, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "23.9.3 (LLPC)", backend: Vulkan }
What you did
Spawned a PbrBundle. When loading a texture with assets.load(), texture filtering mode appears to default to bevy::render::texture::ImageFilterMode::Linear (Intended behavior, based on 0.7 to 0.8 migration guide):
PbrBundle {
mesh: match part {
&Part::Wire => assets.load("models/parts/wire16.obj"),
},
material: materials.add(StandardMaterial {
base_color_texture: Some(assets.load(
"models/parts/materials/wire16.png",
// |settings| {
// *settings = ImageLoaderSettings {
// sampler: bevy::render::texture::ImageSampler::Descriptor(
// ImageSamplerDescriptor {
// //mag_filter: bevy::render::texture::ImageFilterMode::Nearest,
// //min_filter: bevy::render::texture::ImageFilterMode::Nearest,
// //mipmap_filter: bevy::render::texture::ImageFilterMode::Nearest,
// ..default()
// },
// ),
// ..default()
// };
// },
)),
..default()
}),
..default()
},
When loading a texture with assets.load_with_settings() (WITHOUT CHANGING SETTINGS), texture filtering mode appears to default to bevy::render::texture::ImageFilterMode::Nearest (UNINTENDED behavior, based on 0.7 to 0.8 migration guide
PbrBundle {
mesh: match part {
&Part::Wire => assets.load("models/parts/wire16.obj"),
},
material: materials.add(StandardMaterial {
base_color_texture: Some(assets.load_with_settings(
"models/parts/materials/wire16.png",
|settings| {
*settings = ImageLoaderSettings {
sampler: bevy::render::texture::ImageSampler::Descriptor(
ImageSamplerDescriptor {
//mag_filter: bevy::render::texture::ImageFilterMode::Nearest,
//min_filter: bevy::render::texture::ImageFilterMode::Nearest,
//mipmap_filter: bevy::render::texture::ImageFilterMode::Nearest,
..default()
},
),
..default()
};
},
)),
..default()
}),
..default()
},
))
Thanks for the great bug report: it really helps make these easier to fix.
I think the linked migration guide indicates that the default sampler of ImagePlugin used by ImageSampler::Default has been changed to be linear, not the default ImageSampleDescriptor (which still uses nearest as its default).
I'm not sure changing that default would make sense since there is no guarantee it will match the default used in ImagePlugin which is overridable by the user, and the current default impl matches the one from wgpu:SamplerDescriptor, from which ImageSamplerDescriptor is derived.