pub struct Material {Show 14 fields
pub asset_id: AssetId,
pub albedo: Option<TextureHandle>,
pub normal_map: Option<TextureHandle>,
pub emissive_map: Option<TextureHandle>,
pub orm_map: Option<TextureHandle>,
pub roughness: f32,
pub metallic: f32,
pub tint: [f32; 3],
pub emissive_factor: [f32; 3],
pub alpha_cutoff: f32,
pub opacity: f32,
pub transparent: bool,
pub see_through: bool,
pub shader: Option<ShaderHandle>,
}Expand description
Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
albedo: Option<TextureHandle>The Texture asset used as the base colour (albedo) map.
normal_map: Option<TextureHandle>The Texture asset used as a tangent-space normal map.
emissive_map: Option<TextureHandle>The Texture asset used as an emissive map. Multiplied by
emissive_factor to drive the glow; when omitted, only the scalar
emissive_factor is used. Pair a textured emissive with an
emissive_factor above 1 to make the bright parts bloom.
orm_map: Option<TextureHandle>The Texture asset used as a packed surface map: green =
roughness, blue = metalness. When present it overrides the scalar
roughness and metallic per-texel; when omitted those scalars are
used. The red channel is reserved and not read as ambient occlusion:
packed maps in the wild (glTF metallic-roughness, FBX specular maps)
leave red empty, so treating it as occlusion would darken indirect
light to black. Ambient occlusion comes from the screen-space pass.
roughness: f32Perceptual roughness in [0, 1]. 0 = mirror, 1 = fully diffuse. Controls the width of the specular highlight.
metallic: f32Metallic factor in [0, 1]. 0 = dielectric (plastic/stone), 1 = metal. Metallic surfaces tint their reflections with the albedo colour and show almost no diffuse; dielectrics keep a neutral, dim reflection.
tint: [f32; 3]Linear-space RGB multiplier applied to the albedo sample. Useful for tinting a shared texture without a separate asset (e.g. coloured brick).
emissive_factor: [f32; 3]Additive emission colour in linear space. Non-zero values make the surface appear to glow independently of the scene lighting.
alpha_cutoff: f32Alpha-cutout threshold in [0, 1]. When non-zero, a texel whose albedo
alpha falls below it is discarded outright, punching a hole in the
surface: this is how foliage, chain-link, and decal cards are drawn as
one opaque quad. 0 (the default) disables the test and keeps every texel.
Cutout is not glass: the surface still renders in the opaque pass, so
leave transparent and see_through off.
opacity: f32Surface opacity in [0, 1]. 1 = fully opaque (the default). Only
meaningful when transparent is set: it drives how much of the scene
behind the surface shows through the glass.
transparent: boolWhen true, the surface is a translucent dielectric (glass): it renders in the engine’s transparent pass instead of the opaque pass, refracting and reflecting the scene rather than writing solid colour + depth. The importer sets this for materials it detects as glass; authored materials can opt in directly. Defaults to false (opaque).
see_through: boolWhen true, the glass is rendered as genuinely see-through: the scene
behind it shows through with a sharp per-pixel reflection (requires a
ray-tracing-capable GPU). When false (the default), a transparent
surface still renders as low-roughness reflective glass that hides
whatever is behind it. See-through only looks right when the space behind
the glass is actually modelled, so it is opt-in per material. Setting it
implies transparent.
shader: Option<ShaderHandle>The Shader asset that shades surfaces using this material. When omitted, the world’s default shader is used. Referencing a shader from a material ties that shader’s lifetime to the material’s: a shader referenced only by scene-exclusive materials loads and unloads with the scene.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Material
impl<'de> Deserialize<'de> for Material
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Material, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Material, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl ResourceAsset for Material
Source§impl Serialize for Material
impl Serialize for Material
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Material
impl RefUnwindSafe for Material
impl Send for Material
impl Sync for Material
impl Unpin for Material
impl UnsafeUnpin for Material
impl UnwindSafe for Material
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().