From cfd58599a072fc68c71b1157a7119082671a2887 Mon Sep 17 00:00:00 2001 From: Marco Buono Date: Sat, 15 Apr 2023 19:42:18 -0300 Subject: [PATCH] Allow transmission with `AlphaMode::Opaque` materials --- crates/bevy_pbr/src/pbr_material.rs | 1 - crates/bevy_pbr/src/render/pbr.wgsl | 5 ----- 2 files changed, 6 deletions(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index ba2e6f0a6d..cca4275833 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -167,7 +167,6 @@ pub struct StandardMaterial { /// /// The material's [`StandardMaterial::base_color`] also modulates the transmitted light. /// - /// **Important:** For transmission to have any effect, you must also set `alpha_mode` to [`AlphaMode::Blend`]. /// **Note:** Typically used in conjunction with [`StandardMaterial::thickness`] and [`StandardMaterial::ior`]. pub transmission: f32, diff --git a/crates/bevy_pbr/src/render/pbr.wgsl b/crates/bevy_pbr/src/render/pbr.wgsl index 754ea43554..05b6822b93 100644 --- a/crates/bevy_pbr/src/render/pbr.wgsl +++ b/crates/bevy_pbr/src/render/pbr.wgsl @@ -63,11 +63,6 @@ fn fragment(in: FragmentInput) -> @location(0) vec4 { pbr_input.material.base_color = output_color; pbr_input.material.reflectance = material.reflectance; - var transmission = material.transmission; - if (material.flags & STANDARD_MATERIAL_FLAGS_ALPHA_MODE_RESERVED_BITS) != STANDARD_MATERIAL_FLAGS_ALPHA_MODE_BLEND { - // Disable transmission for `alpha_mode` values that are not `AlphaMode::Blend` - transmission = 0.0; - } pbr_input.material.diffuse_transmission = material.diffuse_transmission; pbr_input.material.transmission = material.transmission; pbr_input.material.thickness = material.thickness;