Skip to content

Commit 01043bf

Browse files
committed
Change standard material defaults and update docs (#7664)
# Objective Standard material defaults are currently strange, and the docs are wrong re: metallic. ## Solution Change the defaults to be similar to [Godot](godotengine/godot#62756). --- ## Changelog #### Changed - `StandardMaterial` now defaults to a dielectric material (0.0 `metallic`) with 0.5 `perceptual_roughness`. ## Migration Guide `StandardMaterial`'s default have now changed to be a fully dielectric material with medium roughness. If you want to use the old defaults, you can set `perceptual_roughness = 0.089` and `metallic = 0.01` (though metallic should generally only be set to 0.0 or 1.0).
1 parent 2efc029 commit 01043bf

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

crates/bevy_pbr/src/pbr_material.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,27 @@ pub struct StandardMaterial {
7878

7979
/// Linear perceptual roughness, clamped to `[0.089, 1.0]` in the shader.
8080
///
81-
/// Defaults to minimum of `0.089`.
81+
/// Defaults to `0.5`.
8282
///
8383
/// Low values result in a "glossy" material with specular highlights,
8484
/// while values close to `1` result in rough materials.
8585
///
8686
/// If used together with a roughness/metallic texture, this is factored into the final base
8787
/// color as `roughness * roughness_texture_value`.
88+
///
89+
/// 0.089 is the minimum floating point value that won't be rounded down to 0 in the
90+
/// calculations used.
91+
//
92+
// Technically for 32-bit floats, 0.045 could be used.
93+
// See <https://google.github.io/filament/Filament.html#materialsystem/parameterization/>
8894
pub perceptual_roughness: f32,
8995

90-
/// How "metallic" the material appears, within `[0.0, 1.0]`,
91-
/// going from dielectric to pure metallic.
96+
/// How "metallic" the material appears, within `[0.0, 1.0]`.
9297
///
93-
/// Defaults to `0.01`.
98+
/// This should be set to 0.0 for dielectric materials or 1.0 for metallic materials.
99+
/// For a hybrid surface such as corroded metal, you may need to use in-between values.
94100
///
95-
/// The closer to `1` the value, the more the material will
96-
/// reflect light like a metal such as steel or gold.
101+
/// Defaults to `0.00`, for dielectric.
97102
///
98103
/// If used together with a roughness/metallic texture, this is factored into the final base
99104
/// color as `metallic * metallic_texture_value`.
@@ -236,19 +241,16 @@ pub struct StandardMaterial {
236241
impl Default for StandardMaterial {
237242
fn default() -> Self {
238243
StandardMaterial {
244+
// White because it gets multiplied with texture values if someone uses
245+
// a texture.
239246
base_color: Color::rgb(1.0, 1.0, 1.0),
240247
base_color_texture: None,
241248
emissive: Color::BLACK,
242249
emissive_texture: None,
243-
// This is the minimum the roughness is clamped to in shader code
244-
// See <https://google.github.io/filament/Filament.html#materialsystem/parameterization/>
245-
// It's the minimum floating point value that won't be rounded down to 0 in the
246-
// calculations used. Although technically for 32-bit floats, 0.045 could be
247-
// used.
248-
perceptual_roughness: 0.089,
249-
// Few materials are purely dielectric or metallic
250-
// This is just a default for mostly-dielectric
251-
metallic: 0.01,
250+
// Matches Blender's default roughness.
251+
perceptual_roughness: 0.5,
252+
// Metallic should generally be set to 0.0 or 1.0.
253+
metallic: 0.0,
252254
metallic_roughness_texture: None,
253255
// Minimum real-world reflectance is 2%, most materials between 2-5%
254256
// Expressed in a linear scale and equivalent to 4% reflectance see

0 commit comments

Comments
 (0)