StandardMaterial docs: Make clear that lighting won't look correct if is_srgb is true (#20037)

# Objective

- Fix https://github.com/bevyengine/bevy/issues/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>
This commit is contained in:
T772 2025-07-10 20:41:37 +02:00 committed by GitHub
parent cb64a4aa8a
commit 6792cebfd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -386,6 +386,23 @@ pub struct StandardMaterial {
///
/// [`Mesh::generate_tangents`]: bevy_render::mesh::Mesh::generate_tangents
/// [`Mesh::with_generated_tangents`]: bevy_render::mesh::Mesh::with_generated_tangents
///
/// # Usage
///
/// ```
/// # use bevy_asset::{AssetServer, Handle};
/// # use bevy_ecs::change_detection::Res;
/// # use bevy_image::{Image, ImageLoaderSettings};
/// #
/// fn load_normal_map(asset_server: Res<AssetServer>) {
/// let normal_handle: Handle<Image> = 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]