bevyengine / bevyengine/bevy

Texture Filtering Default Inconsistency

Open
#10,729 2 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## 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](https://bevyengine.org/learn/migration-guides/0.7-0.8/)):
```
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()
},
```
![image](https://github.com/bevyengine/bevy/assets/134224970/43db3b05-a7c9-4665-b989-94a1630cd521)

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](https://bevyengine.org/learn/migration-guides/0.7-0.8/)
```
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()
},
))

```
![image](https://github.com/bevyengine/bevy/assets/134224970/d0694772-b40f-48f2-89ca-ef8500739a23)

Contributor guide

Open the contributing guide

Research direction

Start by tracing the texture-loading paths through assets.load() and assets.load_with_settings(), focusing on ImageLoaderSettings, ImageSampler, and ImageSamplerDescriptor. Compare the sampler defaults produced by both calls against the 0.7-to-0.8 migration guide. Done means both loading APIs use the same intended default filtering behavior, with coverage for the inconsistency.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.