use linear for min

This commit is contained in:
griffi-gh 2024-05-06 17:38:58 +02:00
parent 99cc2d1e72
commit 811bd8d8b4
2 changed files with 4 additions and 4 deletions

View file

@ -40,7 +40,7 @@ var s_diffuse: sampler;
@fragment @fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
let color: vec4<f32> = textureSample(t_diffuse, s_diffuse, in.uv, in.tex_index); let color: vec4<f32> = textureSample(t_diffuse, s_diffuse, in.uv, in.tex_index);
if (color.a == 0.) { if (color.a < 0.5) {
discard; discard;
} }
return color; return color;

View file

@ -70,7 +70,7 @@ pub fn load_prefabs(
address_mode_v: wgpu::AddressMode::ClampToEdge, address_mode_v: wgpu::AddressMode::ClampToEdge,
address_mode_w: wgpu::AddressMode::ClampToEdge, address_mode_w: wgpu::AddressMode::ClampToEdge,
mag_filter: wgpu::FilterMode::Nearest, mag_filter: wgpu::FilterMode::Nearest,
min_filter: wgpu::FilterMode::Nearest, //TODO min_filter Linear, requires filtering sampler min_filter: wgpu::FilterMode::Linear,
mipmap_filter: wgpu::FilterMode::Nearest, mipmap_filter: wgpu::FilterMode::Nearest,
..Default::default() ..Default::default()
}); });
@ -82,7 +82,7 @@ pub fn load_prefabs(
binding: 0, binding: 0,
visibility: wgpu::ShaderStages::FRAGMENT, visibility: wgpu::ShaderStages::FRAGMENT,
ty: wgpu::BindingType::Texture { ty: wgpu::BindingType::Texture {
sample_type: wgpu::TextureSampleType::Float { filterable: false }, sample_type: wgpu::TextureSampleType::Float { filterable: true },
view_dimension: wgpu::TextureViewDimension::D2Array, view_dimension: wgpu::TextureViewDimension::D2Array,
multisampled: false, multisampled: false,
}, },
@ -91,7 +91,7 @@ pub fn load_prefabs(
wgpu::BindGroupLayoutEntry { wgpu::BindGroupLayoutEntry {
binding: 1, binding: 1,
visibility: wgpu::ShaderStages::FRAGMENT, visibility: wgpu::ShaderStages::FRAGMENT,
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::NonFiltering), ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None, count: None,
} }
] ]