Allow transmission with AlphaMode::Opaque materials

This commit is contained in:
Marco Buono 2023-04-15 19:42:18 -03:00
parent 0feafb2463
commit cfd58599a0
2 changed files with 0 additions and 6 deletions

View file

@ -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,

View file

@ -63,11 +63,6 @@ fn fragment(in: FragmentInput) -> @location(0) vec4<f32> {
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;