Struct bevy_pbr::StandardMaterial [−][src]
pub struct StandardMaterial {Show 13 fields
pub base_color: Color,
pub base_color_texture: Option<Handle<Image>>,
pub emissive: Color,
pub emissive_texture: Option<Handle<Image>>,
pub perceptual_roughness: f32,
pub metallic: f32,
pub metallic_roughness_texture: Option<Handle<Image>>,
pub reflectance: f32,
pub normal_map_texture: Option<Handle<Image>>,
pub occlusion_texture: Option<Handle<Image>>,
pub double_sided: bool,
pub unlit: bool,
pub alpha_mode: AlphaMode,
}
Expand description
A material with “standard” properties used in PBR lighting Standard property values with pictures here https://google.github.io/filament/Material%20Properties.pdf.
Fields
base_color: Color
Doubles as diffuse albedo for non-metallic, specular for metallic and a mix for everything
in between. If used together with a base_color_texture, this is factored into the final
base color as base_color * base_color_texture_value
base_color_texture: Option<Handle<Image>>
emissive: Color
emissive_texture: Option<Handle<Image>>
perceptual_roughness: f32
Linear perceptual roughness, clamped to [0.089, 1.0] in the shader
Defaults to minimum of 0.089
If used together with a roughness/metallic texture, this is factored into the final base
color as roughness * roughness_texture_value
metallic: f32
From [0.0, 1.0], dielectric to pure metallic
If used together with a roughness/metallic texture, this is factored into the final base
color as metallic * metallic_texture_value
metallic_roughness_texture: Option<Handle<Image>>
reflectance: f32
Specular intensity for non-metals on a linear scale of [0.0, 1.0] defaults to 0.5 which is mapped to 4% reflectance in the shader
normal_map_texture: Option<Handle<Image>>
occlusion_texture: Option<Handle<Image>>
double_sided: bool
unlit: bool
alpha_mode: AlphaMode
Trait Implementations
type ExtractedAsset = StandardMaterial
type ExtractedAsset = StandardMaterial
The representation of the the asset in the “render world”.
type PreparedAsset = GpuStandardMaterial
type PreparedAsset = GpuStandardMaterial
The GPU-representation of the the asset.
type Param = (SRes<RenderDevice>, SRes<MaterialPipeline<StandardMaterial>>, SRes<RenderAssets<Image>>)
type Param = (SRes<RenderDevice>, SRes<MaterialPipeline<StandardMaterial>>, SRes<RenderAssets<Image>>)
Specifies all ECS data required by RenderAsset::prepare_asset
.
For convenience use the lifetimeless
SystemParams. Read more
Converts the asset into a RenderAsset::ExtractedAsset
.
fn prepare_asset(
material: Self::ExtractedAsset,
(render_device, pbr_pipeline, gpu_images): &mut SystemParamItem<'_, '_, Self::Param>
) -> Result<Self::PreparedAsset, PrepareAssetError<Self::ExtractedAsset>>
fn prepare_asset(
material: Self::ExtractedAsset,
(render_device, pbr_pipeline, gpu_images): &mut SystemParamItem<'_, '_, Self::Param>
) -> Result<Self::PreparedAsset, PrepareAssetError<Self::ExtractedAsset>>
Prepares the extracted asset
for the GPU by transforming it into
a RenderAsset::PreparedAsset
. Therefore ECS data may be accessed via the param
. Read more
type Key = StandardMaterialKey
type Key = StandardMaterialKey
The key used to specialize this material’s RenderPipelineDescriptor
.
Extract the SpecializedMaterial::Key
for the “prepared” version of this material. This key will be
passed in to the SpecializedMaterial::specialize
function when compiling the RenderPipeline
for a given entity’s material. Read more
Specializes the given descriptor
according to the given key
.
Returns this material’s BindGroup
. This should match the layout returned by SpecializedMaterial::bind_group_layout
.
Returns this material’s BindGroupLayout
. This should match the BindGroup
returned by SpecializedMaterial::bind_group
.
Returns this material’s AlphaMode
. Defaults to AlphaMode::Opaque
.
Auto Trait Implementations
impl RefUnwindSafe for StandardMaterial
impl Send for StandardMaterial
impl Sync for StandardMaterial
impl Unpin for StandardMaterial
impl UnwindSafe for StandardMaterial
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Creates Self
using data from the given World
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more