Skip to content

Commit 6792ceb

Browse files
772alice-i-cecileBD103
authored
StandardMaterial docs: Make clear that lighting won't look correct if is_srgb is true (#20037)
# Objective - Fix #12123 ## Solution - Add a code example found here: https://github.com/bevyengine/bevy/blob/main/examples/3d/parallax_mapping.rs#L209 to https://docs.rs/bevy/latest/bevy/pbr/struct.StandardMaterial.html ## Testing - This pull request if only changing docs. But I tested the formatting via ```cargo doc --no-deps --open```. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com>
1 parent cb64a4a commit 6792ceb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

crates/bevy_pbr/src/pbr_material.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,23 @@ pub struct StandardMaterial {
386386
///
387387
/// [`Mesh::generate_tangents`]: bevy_render::mesh::Mesh::generate_tangents
388388
/// [`Mesh::with_generated_tangents`]: bevy_render::mesh::Mesh::with_generated_tangents
389+
///
390+
/// # Usage
391+
///
392+
/// ```
393+
/// # use bevy_asset::{AssetServer, Handle};
394+
/// # use bevy_ecs::change_detection::Res;
395+
/// # use bevy_image::{Image, ImageLoaderSettings};
396+
/// #
397+
/// fn load_normal_map(asset_server: Res<AssetServer>) {
398+
/// let normal_handle: Handle<Image> = asset_server.load_with_settings(
399+
/// "textures/parallax_example/cube_normal.png",
400+
/// // The normal map texture is in linear color space. Lighting won't look correct
401+
/// // if `is_srgb` is `true`, which is the default.
402+
/// |settings: &mut ImageLoaderSettings| settings.is_srgb = false,
403+
/// );
404+
/// }
405+
/// ```
389406
#[texture(9)]
390407
#[sampler(10)]
391408
#[dependency]

0 commit comments

Comments
 (0)