pub struct Material {
pub base_color: [f32; 3],
pub ambient: f32,
pub diffuse: f32,
pub specular: f32,
pub shininess: f32,
pub metallic: f32,
pub roughness: f32,
pub opacity: f32,
pub texture_id: Option<u64>,
pub normal_map_id: Option<u64>,
pub ao_map_id: Option<u64>,
pub use_pbr: bool,
}Expand description
Per-object material properties for Blinn-Phong and PBR shading.
Materials carry all shading parameters that were previously global in LightingSettings.
Each SceneRenderItem now has its own Material, enabling per-object visual distinction.
Fields§
§base_color: [f32; 3]Base diffuse color [r, g, b] in linear 0..1 range. Default [0.7, 0.7, 0.7].
ambient: f32Ambient light coefficient. Default 0.15.
diffuse: f32Diffuse light coefficient. Default 0.75.
specular: f32Specular highlight coefficient. Default 0.4.
shininess: f32Specular shininess exponent. Default 32.0.
metallic: f32Metallic factor for PBR Cook-Torrance shading. 0=dielectric, 1=metal. Default 0.0.
roughness: f32Roughness factor for PBR microfacet distribution. 0=mirror, 1=fully rough. Default 0.5.
opacity: f32Opacity (1.0 = fully opaque, 0.0 = fully transparent). Default 1.0.
texture_id: Option<u64>Optional albedo texture identifier. None = no texture applied. Default None.
normal_map_id: Option<u64>Optional normal map texture identifier. None = no normal mapping. Default None.
The normal map must be in tangent-space with XY encoded as RG (0..1 -> -1..+1). Requires UVs and tangents on the mesh for correct TBN construction.
ao_map_id: Option<u64>Optional ambient occlusion map texture identifier. None = no AO map. Default None.
The AO map R channel encodes cavity factor (0=fully occluded, 1=fully lit). Applied multiplicatively to ambient and diffuse terms.
use_pbr: boolUse Cook-Torrance PBR shading instead of Blinn-Phong. Default false.
When true, metallic and roughness drive the GGX BRDF.
PBR outputs linear HDR values; enable post_process.enabled for correct tone mapping.
Implementations§
Trait Implementations§
impl Copy 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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<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.