From 8ae89f37b0370b2298e3b08b5b3623f084e93b06 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Mon, 6 May 2024 17:38:58 +0200 Subject: [PATCH] use linear for min --- kubi/shaders/world.wgsl | 2 +- kubi/src/prefabs.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kubi/shaders/world.wgsl b/kubi/shaders/world.wgsl index d9b6069..185b3bd 100644 --- a/kubi/shaders/world.wgsl +++ b/kubi/shaders/world.wgsl @@ -40,7 +40,7 @@ var s_diffuse: sampler; @fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { let color: vec4 = textureSample(t_diffuse, s_diffuse, in.uv, in.tex_index); - if (color.a == 0.) { + if (color.a < 0.5) { discard; } return color; diff --git a/kubi/src/prefabs.rs b/kubi/src/prefabs.rs index 08bd3e9..9932999 100644 --- a/kubi/src/prefabs.rs +++ b/kubi/src/prefabs.rs @@ -70,7 +70,7 @@ pub fn load_prefabs( address_mode_v: wgpu::AddressMode::ClampToEdge, address_mode_w: wgpu::AddressMode::ClampToEdge, 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, ..Default::default() }); @@ -82,7 +82,7 @@ pub fn load_prefabs( binding: 0, visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Texture { - sample_type: wgpu::TextureSampleType::Float { filterable: false }, + sample_type: wgpu::TextureSampleType::Float { filterable: true }, view_dimension: wgpu::TextureViewDimension::D2Array, multisampled: false, }, @@ -91,7 +91,7 @@ pub fn load_prefabs( wgpu::BindGroupLayoutEntry { binding: 1, visibility: wgpu::ShaderStages::FRAGMENT, - ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::NonFiltering), + ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering), count: None, } ]