From 53897da2d5e05601c31613337dce05538ba5be96 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Mon, 13 Feb 2023 15:52:35 -0500 Subject: [PATCH 1/3] update standard material defaults --- crates/bevy_pbr/src/pbr_material.rs | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 998f728c11f14..0607545593835 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -78,22 +78,26 @@ pub struct StandardMaterial { /// Linear perceptual roughness, clamped to `[0.089, 1.0]` in the shader. /// - /// Defaults to minimum of `0.089`. + /// Defaults to `0.5`. /// /// Low values result in a "glossy" material with specular highlights, /// while values close to `1` result in rough materials. /// /// If used together with a roughness/metallic texture, this is factored into the final base /// color as `roughness * roughness_texture_value`. + /// + /// 0.089 is the minimum floating point value that won't be rounded down to 0 in the + /// calculations used. + // + // Technically for 32-bit floats, 0.045 could be used. + // See pub perceptual_roughness: f32, - /// How "metallic" the material appears, within `[0.0, 1.0]`, - /// going from dielectric to pure metallic. + /// How "metallic" the material appears, within `[0.0, 1.0]`. /// - /// Defaults to `0.01`. + /// This should be set to 0.0 or 1.0, depending on if the material is metallic or dielectric. /// - /// The closer to `1` the value, the more the material will - /// reflect light like a metal such as steel or gold. + /// Defaults to `0.00`. /// /// If used together with a roughness/metallic texture, this is factored into the final base /// color as `metallic * metallic_texture_value`. @@ -236,19 +240,15 @@ pub struct StandardMaterial { impl Default for StandardMaterial { fn default() -> Self { StandardMaterial { - base_color: Color::rgb(1.0, 1.0, 1.0), + // Mid-grey to approximate how bright most materials are. + base_color: Color::rgb(0.5, 0.5, 0.5), base_color_texture: None, emissive: Color::BLACK, emissive_texture: None, - // This is the minimum the roughness is clamped to in shader code - // See - // It's the minimum floating point value that won't be rounded down to 0 in the - // calculations used. Although technically for 32-bit floats, 0.045 could be - // used. - perceptual_roughness: 0.089, - // Few materials are purely dielectric or metallic - // This is just a default for mostly-dielectric - metallic: 0.01, + // Matches Blender's default roughness. + perceptual_roughness: 0.5, + // Metallic should be set to 0.0 or 1.0. + metallic: 0.00, metallic_roughness_texture: None, // Minimum real-world reflectance is 2%, most materials between 2-5% // Expressed in a linear scale and equivalent to 4% reflectance see From 746c111552c0e461dab2b492ea5f440aaa984807 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Mon, 13 Feb 2023 16:21:35 -0500 Subject: [PATCH 2/3] white base colour, docs for hybrid metallic surfaces --- crates/bevy_pbr/src/pbr_material.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 0607545593835..626f60a026fc6 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -96,6 +96,7 @@ pub struct StandardMaterial { /// How "metallic" the material appears, within `[0.0, 1.0]`. /// /// This should be set to 0.0 or 1.0, depending on if the material is metallic or dielectric. + /// For a hybrid surface such as corroded metal, you may need to use in-between values. /// /// Defaults to `0.00`. /// @@ -240,14 +241,15 @@ pub struct StandardMaterial { impl Default for StandardMaterial { fn default() -> Self { StandardMaterial { - // Mid-grey to approximate how bright most materials are. - base_color: Color::rgb(0.5, 0.5, 0.5), + // White because it gets multiplied with texture values if someone uses + // a texture. + base_color: Color::rgb(1.0, 1.0, 1.0), base_color_texture: None, emissive: Color::BLACK, emissive_texture: None, // Matches Blender's default roughness. perceptual_roughness: 0.5, - // Metallic should be set to 0.0 or 1.0. + // Metallic should generally be set to 0.0 or 1.0. metallic: 0.00, metallic_roughness_texture: None, // Minimum real-world reflectance is 2%, most materials between 2-5% From d286639fd9d85672c582b64defcf543b78665e21 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Mon, 13 Feb 2023 16:36:33 -0500 Subject: [PATCH 3/3] docs and oops --- crates/bevy_pbr/src/pbr_material.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 626f60a026fc6..aa4519414f27e 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -95,10 +95,10 @@ pub struct StandardMaterial { /// How "metallic" the material appears, within `[0.0, 1.0]`. /// - /// This should be set to 0.0 or 1.0, depending on if the material is metallic or dielectric. + /// This should be set to 0.0 for dielectric materials or 1.0 for metallic materials. /// For a hybrid surface such as corroded metal, you may need to use in-between values. /// - /// Defaults to `0.00`. + /// Defaults to `0.00`, for dielectric. /// /// If used together with a roughness/metallic texture, this is factored into the final base /// color as `metallic * metallic_texture_value`. @@ -250,7 +250,7 @@ impl Default for StandardMaterial { // Matches Blender's default roughness. perceptual_roughness: 0.5, // Metallic should generally be set to 0.0 or 1.0. - metallic: 0.00, + metallic: 0.0, metallic_roughness_texture: None, // Minimum real-world reflectance is 2%, most materials between 2-5% // Expressed in a linear scale and equivalent to 4% reflectance see