pub struct MaterialComponent {Show 80 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 detail_base_texture: Option<String>,
pub detail_normal_texture: Option<String>,
pub detail_uv_scale: f32,
pub height_texture: Option<String>,
pub parallax_scale: f32,
pub reflection_box_min: [f32; 3],
pub reflection_box_max: [f32; 3],
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).
detail_base_texture: Option<String>Detail albedo texture, tiled by detail_uv_scale and overlaid on the
base color for close-up surface variation. Load with TextureUsage::Color
so it lands in the sRGB texture array.
detail_normal_texture: Option<String>Detail normal map, reoriented onto the base surface normal. Load with
TextureUsage::Linear.
detail_uv_scale: f32UV tiling multiplier applied to the detail textures.
height_texture: Option<String>Height map for single-step parallax offset mapping. Load with
TextureUsage::Linear.
parallax_scale: f32Parallax height scale in UV units (0 disables parallax).
reflection_box_min: [f32; 3]World-space minimum corner of the reflection box used to reproject the environment reflection so it aligns with a finite room instead of an infinitely distant environment. Equal min and max disables box projection.
reflection_box_max: [f32; 3]World-space maximum corner of the reflection box.
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 From<&Material> for SceneMaterial
impl From<&Material> for SceneMaterial
Source§fn from(material: &Material) -> SceneMaterial
fn from(material: &Material) -> SceneMaterial
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<T> FromFormData for Twhere
T: DeserializeOwned,
impl<T> FromFormData for Twhere
T: DeserializeOwned,
Source§fn from_event(ev: &Event) -> Result<T, FromFormDataError>
fn from_event(ev: &Event) -> Result<T, FromFormDataError>
submit event.Source§impl<CustErr, T, Request> FromReq<GetUrl, Request, CustErr> for T
impl<CustErr, T, Request> FromReq<GetUrl, Request, CustErr> for T
Source§async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
Source§impl<CustErr, T, Request> FromReq<Json, Request, CustErr> for T
impl<CustErr, T, Request> FromReq<Json, Request, CustErr> for T
Source§async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
Source§impl<CustErr, T, Request> FromReq<PostUrl, Request, CustErr> for T
impl<CustErr, T, Request> FromReq<PostUrl, Request, CustErr> for T
Source§async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
Source§impl<CustErr, T, Response> FromRes<Json, Response, CustErr> for T
impl<CustErr, T, Response> FromRes<Json, Response, CustErr> for T
Source§async fn from_res(res: Response) -> Result<T, ServerFnError<CustErr>>
async fn from_res(res: Response) -> Result<T, ServerFnError<CustErr>>
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<CustErr, T, Response> IntoRes<Json, Response, CustErr> for T
impl<CustErr, T, Response> IntoRes<Json, Response, CustErr> for T
Source§async fn into_res(self) -> Result<Response, ServerFnError<CustErr>>
async fn into_res(self) -> Result<Response, ServerFnError<CustErr>>
Source§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
impl<T> SerializableAny for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Source§fn into_taken(self) -> T
fn into_taken(self) -> 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.