pub struct Material {Show 73 fields
pub base_color: [f32; 4],
pub emissive_factor: [f32; 3],
pub alpha_mode: AlphaMode,
pub alpha_cutoff: f32,
pub blend_opaque_alpha_threshold: f32,
pub base_texture: Option<String>,
pub base_texture_transform: TextureTransform,
pub emissive_texture: Option<String>,
pub emissive_texture_transform: TextureTransform,
pub normal_texture: Option<String>,
pub normal_texture_transform: TextureTransform,
pub normal_scale: f32,
pub normal_map_flip_y: bool,
pub normal_map_two_component: bool,
pub metallic_roughness_texture: Option<String>,
pub metallic_roughness_texture_transform: TextureTransform,
pub occlusion_texture: Option<String>,
pub occlusion_texture_transform: TextureTransform,
pub occlusion_strength: f32,
pub roughness: f32,
pub metallic: f32,
pub unlit: bool,
pub double_sided: bool,
pub transmission_factor: f32,
pub transmission_texture: Option<String>,
pub transmission_texture_transform: TextureTransform,
pub thickness: f32,
pub thickness_texture: Option<String>,
pub thickness_texture_transform: TextureTransform,
pub attenuation_color: [f32; 3],
pub attenuation_distance: f32,
pub ior: f32,
pub specular_factor: f32,
pub specular_color_factor: [f32; 3],
pub specular_texture: Option<String>,
pub specular_texture_transform: TextureTransform,
pub specular_color_texture: Option<String>,
pub specular_color_texture_transform: TextureTransform,
pub emissive_strength: f32,
pub diffuse_transmission_factor: f32,
pub diffuse_transmission_texture: Option<String>,
pub diffuse_transmission_texture_transform: TextureTransform,
pub diffuse_transmission_color_factor: [f32; 3],
pub diffuse_transmission_color_texture: Option<String>,
pub diffuse_transmission_color_texture_transform: TextureTransform,
pub dispersion: f32,
pub anisotropy_strength: f32,
pub anisotropy_rotation: f32,
pub anisotropy_texture: Option<String>,
pub anisotropy_texture_transform: TextureTransform,
pub iridescence_factor: f32,
pub iridescence_texture: Option<String>,
pub iridescence_texture_transform: TextureTransform,
pub iridescence_ior: f32,
pub iridescence_thickness_minimum: f32,
pub iridescence_thickness_maximum: f32,
pub iridescence_thickness_texture: Option<String>,
pub iridescence_thickness_texture_transform: TextureTransform,
pub sheen_color_factor: [f32; 3],
pub sheen_color_texture: Option<String>,
pub sheen_color_texture_transform: TextureTransform,
pub sheen_roughness_factor: f32,
pub sheen_roughness_texture: Option<String>,
pub sheen_roughness_texture_transform: TextureTransform,
pub clearcoat_factor: f32,
pub clearcoat_texture: Option<String>,
pub clearcoat_texture_transform: TextureTransform,
pub clearcoat_roughness_factor: f32,
pub clearcoat_roughness_texture: Option<String>,
pub clearcoat_roughness_texture_transform: TextureTransform,
pub clearcoat_normal_texture: Option<String>,
pub clearcoat_normal_texture_transform: TextureTransform,
pub clearcoat_normal_scale: f32,
}Expand description
PBR material definition following glTF 2.0 conventions.
Supports the metallic-roughness workflow with optional textures for each parameter. Includes glTF extensions: KHR_materials_transmission, KHR_materials_volume, KHR_materials_specular, and KHR_materials_emissive_strength.
Fields§
§base_color: [f32; 4]Base color (albedo) as RGBA. Multiplied with base_texture if present.
emissive_factor: [f32; 3]Emissive color multiplier as RGB.
alpha_mode: AlphaModeTransparency handling mode.
alpha_cutoff: f32Alpha threshold for AlphaMode::Mask.
blend_opaque_alpha_threshold: f32Alpha threshold above which a fragment of an AlphaMode::Blend
material is treated as effectively opaque by the depth prepass:
fragments at or above this value write depth so transparent
fragments behind them are correctly occluded; fragments below
the threshold skip the prepass and accumulate through OIT.
Defaults to 0.99; lower it for materials with soft alpha edges
like anti-aliased text or decals where a tighter threshold
produces visible halos in OIT.
base_texture: Option<String>Path to base color texture.
base_texture_transform: TextureTransform§emissive_texture: Option<String>Path to emissive texture.
emissive_texture_transform: TextureTransform§normal_texture: Option<String>Path to normal map texture.
normal_texture_transform: TextureTransform§normal_scale: f32Normal map intensity multiplier.
normal_map_flip_y: boolFlip normal map Y (green) channel for DirectX-style maps.
normal_map_two_component: boolTwo-component normal map (RG only, B reconstructed).
metallic_roughness_texture: Option<String>Path to metallic (B) / roughness (G) texture.
metallic_roughness_texture_transform: TextureTransform§occlusion_texture: Option<String>Path to ambient occlusion texture (R channel).
occlusion_texture_transform: TextureTransform§occlusion_strength: f32Occlusion effect strength (0 = none, 1 = full).
roughness: f32Surface roughness (0 = smooth/mirror, 1 = rough/diffuse).
metallic: f32Metallic factor (0 = dielectric, 1 = metal).
unlit: boolSkip lighting calculations (flat shaded).
double_sided: boolRender both sides of faces.
transmission_factor: f32Transmission factor for refractive materials (KHR_materials_transmission).
transmission_texture: Option<String>§transmission_texture_transform: TextureTransform§thickness: f32Volume thickness for transmission (KHR_materials_volume).
thickness_texture: Option<String>§thickness_texture_transform: TextureTransform§attenuation_color: [f32; 3]Light absorption color inside the volume.
attenuation_distance: f32Distance at which light is attenuated to attenuation_color.
ior: f32Index of refraction (default 1.5 for glass).
specular_factor: f32Specular intensity override (KHR_materials_specular).
specular_color_factor: [f32; 3]Specular color tint.
specular_texture: Option<String>§specular_texture_transform: TextureTransform§specular_color_texture: Option<String>§specular_color_texture_transform: TextureTransform§emissive_strength: f32Emissive intensity multiplier (KHR_materials_emissive_strength).
diffuse_transmission_factor: f32Diffuse transmission factor (KHR_materials_diffuse_transmission). Fraction of base color light transmitted as Lambertian through the surface.
diffuse_transmission_texture: Option<String>§diffuse_transmission_texture_transform: TextureTransform§diffuse_transmission_color_factor: [f32; 3]Color tint applied to the diffuse-transmitted light.
diffuse_transmission_color_texture: Option<String>§diffuse_transmission_color_texture_transform: TextureTransform§dispersion: f32Chromatic dispersion strength (KHR_materials_dispersion). Splits the refraction angle per wavelength using Cauchy’s approximation.
anisotropy_strength: f32Anisotropy strength (KHR_materials_anisotropy). 0 = isotropic, 1 = maximum.
anisotropy_rotation: f32Rotation of anisotropic direction in radians around the surface normal.
anisotropy_texture: Option<String>§anisotropy_texture_transform: TextureTransform§iridescence_factor: f32Iridescence strength (KHR_materials_iridescence). 0 = none, 1 = full thin-film effect.
iridescence_texture: Option<String>§iridescence_texture_transform: TextureTransform§iridescence_ior: f32Index of refraction for the iridescent thin-film layer.
iridescence_thickness_minimum: f32Minimum film thickness in nanometers.
iridescence_thickness_maximum: f32Maximum film thickness in nanometers (modulated by iridescence_thickness_texture.g).
iridescence_thickness_texture: Option<String>§iridescence_thickness_texture_transform: TextureTransform§sheen_color_factor: [f32; 3]Sheen color (KHR_materials_sheen). Multiplied with sheen_color_texture if present.
sheen_color_texture: Option<String>§sheen_color_texture_transform: TextureTransform§sheen_roughness_factor: f32Sheen roughness (0 = sharp, 1 = smooth velvet).
sheen_roughness_texture: Option<String>§sheen_roughness_texture_transform: TextureTransform§clearcoat_factor: f32Clearcoat layer strength (KHR_materials_clearcoat). 0 = none, 1 = full coat.
clearcoat_texture: Option<String>§clearcoat_texture_transform: TextureTransform§clearcoat_roughness_factor: f32Clearcoat layer roughness.
clearcoat_roughness_texture: Option<String>§clearcoat_roughness_texture_transform: TextureTransform§clearcoat_normal_texture: Option<String>Optional separate normal map for the clearcoat layer.
clearcoat_normal_texture_transform: TextureTransform§clearcoat_normal_scale: f32Implementations§
Source§impl Material
impl Material
Sourcepub fn is_transparent(&self) -> bool
pub fn is_transparent(&self) -> bool
Returns true if this material requires transparency handling.
Sourcepub fn texture_names(&self) -> impl Iterator<Item = &str>
pub fn texture_names(&self) -> impl Iterator<Item = &str>
Yields every texture name referenced by this material across every PBR slot (base color, normal map, metallic-roughness, all glTF extension textures). Used by the texture cache to bump and drop reference counts without missing any slots.
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>,
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,
impl StructuralPartialEq for Material
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>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.