From 6a46e238802b2b4495dfac88727ba10820f63eca Mon Sep 17 00:00:00 2001 From: T772 Date: Tue, 8 Jul 2025 19:02:31 +0200 Subject: [PATCH 1/6] Make clear that lighting won't look correct if `is_srgb` is `false` --- crates/bevy_pbr/src/pbr_material.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 0207a81ed06ef..0adfbf931dd1f 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -386,6 +386,17 @@ pub struct StandardMaterial { /// /// [`Mesh::generate_tangents`]: bevy_render::mesh::Mesh::generate_tangents /// [`Mesh::with_generated_tangents`]: bevy_render::mesh::Mesh::with_generated_tangents + /// + /// # Usage + /// + /// ```rust + /// let normal_handle = asset_server.load_with_settings( + /// "textures/parallax_example/cube_normal.png", + /// // The normal map texture is in linear color space. Lighting won't look correct + /// // if `is_srgb` is `true`, which is the default. + /// |settings: &mut ImageLoaderSettings| settings.is_srgb = false, + /// ); + /// ``` #[texture(9)] #[sampler(10)] #[dependency] From 0cf8679161331c0ba2e7d2e1e2f4873875c90bc7 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 8 Jul 2025 15:09:08 -0400 Subject: [PATCH 2/6] CI plz Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com> --- crates/bevy_pbr/src/pbr_material.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 0adfbf931dd1f..4d3a23a1b57e3 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -389,13 +389,19 @@ pub struct StandardMaterial { /// /// # Usage /// - /// ```rust - /// let normal_handle = asset_server.load_with_settings( - /// "textures/parallax_example/cube_normal.png", - /// // The normal map texture is in linear color space. Lighting won't look correct - /// // if `is_srgb` is `true`, which is the default. - /// |settings: &mut ImageLoaderSettings| settings.is_srgb = false, - /// ); + /// ``` + /// # use bevy_asset::AssetServer; + /// # use bevy_ecs::ecs::change_detection::Res; + /// # use bevy_image::ImageLoaderSettings; + /// # + /// fn load_normal_map(asset_server: Res) { + /// let normal_handle = asset_server.load_with_settings( + /// "textures/parallax_example/cube_normal.png", + /// // The normal map texture is in linear color space. Lighting won't look correct + /// // if `is_srgb` is `true`, which is the default. + /// |settings: &mut ImageLoaderSettings| settings.is_srgb = false, + /// ); + /// } /// ``` #[texture(9)] #[sampler(10)] From 63ae58bd705f6dbd9ebd5c88f3f240a572d0dde6 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 8 Jul 2025 12:56:07 -0700 Subject: [PATCH 3/6] Update crates/bevy_pbr/src/pbr_material.rs Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com> --- crates/bevy_pbr/src/pbr_material.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 4d3a23a1b57e3..efb18b067ebf3 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -391,7 +391,7 @@ pub struct StandardMaterial { /// /// ``` /// # use bevy_asset::AssetServer; - /// # use bevy_ecs::ecs::change_detection::Res; + /// # use bevy_ecs::change_detection::Res; /// # use bevy_image::ImageLoaderSettings; /// # /// fn load_normal_map(asset_server: Res) { From aa54dd6076ac8218fbf8788765bc6a1408dbd474 Mon Sep 17 00:00:00 2001 From: T772 Date: Thu, 10 Jul 2025 18:51:46 +0200 Subject: [PATCH 4/6] Fix CI warning (Handle). --- crates/bevy_pbr/src/pbr_material.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index efb18b067ebf3..6d0cd2780c6b8 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -395,7 +395,7 @@ pub struct StandardMaterial { /// # use bevy_image::ImageLoaderSettings; /// # /// fn load_normal_map(asset_server: Res) { - /// let normal_handle = asset_server.load_with_settings( + /// let normal_handle: Handle = asset_server.load_with_settings( /// "textures/parallax_example/cube_normal.png", /// // The normal map texture is in linear color space. Lighting won't look correct /// // if `is_srgb` is `true`, which is the default. From 86d353881c200c6799ae5f5866c72201f85483cb Mon Sep 17 00:00:00 2001 From: T772 Date: Thu, 10 Jul 2025 19:00:59 +0200 Subject: [PATCH 5/6] Fix another CI warning. --- crates/bevy_pbr/src/pbr_material.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 6d0cd2780c6b8..a04e0d73c7634 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -392,7 +392,7 @@ pub struct StandardMaterial { /// ``` /// # use bevy_asset::AssetServer; /// # use bevy_ecs::change_detection::Res; - /// # use bevy_image::ImageLoaderSettings; + /// # use bevy_image::{Image, ImageLoaderSettings}; /// # /// fn load_normal_map(asset_server: Res) { /// let normal_handle: Handle = asset_server.load_with_settings( From 835147b99febc74896d1372d49696a93854caf5f Mon Sep 17 00:00:00 2001 From: T772 Date: Thu, 10 Jul 2025 19:35:03 +0200 Subject: [PATCH 6/6] Fix another CI error (Handle was missing as an import) --- crates/bevy_pbr/src/pbr_material.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index a04e0d73c7634..d7baef3a9a8d4 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -390,7 +390,7 @@ pub struct StandardMaterial { /// # Usage /// /// ``` - /// # use bevy_asset::AssetServer; + /// # use bevy_asset::{AssetServer, Handle}; /// # use bevy_ecs::change_detection::Res; /// # use bevy_image::{Image, ImageLoaderSettings}; /// #