Skip to main content

SurfaceMaterial

Struct SurfaceMaterial 

Source
pub struct SurfaceMaterial {
Show 28 fields pub base_color: [f32; 3], pub base_color_texture: Option<TextureHandle>, pub metalness: f32, pub roughness: f32, pub orm_texture: Option<TextureHandle>, pub normal_texture: Option<TextureHandle>, pub normal_scale: f32, pub specular_ior: f32, pub specular_tint: [f32; 3], pub emission_color: [f32; 3], pub emission_scale: f32, pub emission_texture: Option<TextureHandle>, pub coat_weight: f32, pub coat_roughness: f32, pub coat_ior: f32, pub coat_normal_texture: Option<TextureHandle>, pub sheen_weight: f32, pub sheen_color: [f32; 3], pub sheen_roughness: f32, pub subsurface_weight: f32, pub subsurface_color: [f32; 3], pub subsurface_radius: [f32; 3], pub opacity: f32, pub opacity_texture: Option<TextureHandle>, pub alpha_mode: AlphaMode, pub alpha_cutoff: f32, pub uv_scale: [f32; 2], pub uv_offset: [f32; 2],
}
Expand description

Metallic/roughness PBR material for scene geometry.

OA evaluates GGX specular and Lambertian diffuse using base color, metalness, perceptual roughness, and dielectric index of refraction. Direct light, flat ambient, and emission form the current renderer subset. Base/ORM/normal descriptors are connected, but their sampling variants are not enabled by the current shader build. Texture sampling, coat, sheen, subsurface, separate emission/opacity maps, and interchange adapters remain Planned.

Texture channel packing (ORM convention):

  • orm_texture R = ambient occlusion, G = roughness, B = metalness.
  • normal_texture stores tangent-space XY as BC5 SNORM; Z is reconstructed as sqrt(saturate(1 - dot(n.xy, n.xy))).

All color values are linear at this API boundary.

Fields§

§base_color: [f32; 3]

Linear RGB base color. Default [0.8, 0.8, 0.8].

§base_color_texture: Option<TextureHandle>

Optional base-color texture. Format admission belongs to the renderer.

§metalness: f32

Metalness in [0, 1]. Default 0.0 (dielectric).

§roughness: f32

Perceptual roughness in [0, 1]. Default 0.5. Squared to α in the shader for the GGX distribution.

§orm_texture: Option<TextureHandle>

Optional ORM texture (R=occlusion, G=roughness, B=metalness).

§normal_texture: Option<TextureHandle>

Optional tangent-space normal texture (BC5 SNORM XY).

§normal_scale: f32

Normal map strength multiplier. Default 1.0.

§specular_ior: f32

Index of refraction for dielectric F0 derivation. Default 1.5 (glass/plastic → F0 ≈ 0.04).

§specular_tint: [f32; 3]

Linear RGB tint applied to the specular F0. Default [1, 1, 1].

§emission_color: [f32; 3]

Linear RGB emissive color. Default [0, 0, 0].

§emission_scale: f32

HDR intensity multiplier for emission. Default 0.0.

§emission_texture: Option<TextureHandle>

Optional emissive texture (BC6H UFLOAT or RGBA16F).

§coat_weight: f32

Clear coat weight in [0, 1]. Default 0.0. Rendering is Planned.

§coat_roughness: f32

Clear coat perceptual roughness in [0, 1]. Default 0.03.

§coat_ior: f32

Clear coat IOR. Default 1.5.

§coat_normal_texture: Option<TextureHandle>

Optional separate tangent-space normal for the coat layer.

§sheen_weight: f32

Sheen weight in [0, 1]. Default 0.0. Rendering is Planned.

§sheen_color: [f32; 3]

Linear RGB sheen color. Default [1, 1, 1].

§sheen_roughness: f32

Sheen perceptual roughness in [0, 1]. Default 0.3.

§subsurface_weight: f32

Subsurface weight in [0, 1]. Default 0.0. Rendering is Planned.

§subsurface_color: [f32; 3]

Linear RGB subsurface color. Default [1, 1, 1].

§subsurface_radius: [f32; 3]

Per-channel scattering distance in world units (RGB). Default [1, 1, 1].

§opacity: f32

Global opacity multiplier in [0, 1]. Default 1.0.

§opacity_texture: Option<TextureHandle>

Optional single-channel (R) opacity texture.

§alpha_mode: AlphaMode

Alpha mode for this surface.

§alpha_cutoff: f32

Alpha cutoff threshold for AlphaMode::AlphaTest. Default 0.5.

§uv_scale: [f32; 2]

UV scale applied before sampling all maps. Default [1, 1].

§uv_offset: [f32; 2]

UV offset applied after scaling. Default [0, 0].

Implementations§

Source§

impl SurfaceMaterial

Source

pub fn validate(&self) -> Result<()>

Validate that all scalar parameters are finite and in-range.

Trait Implementations§

Source§

impl Clone for SurfaceMaterial

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SurfaceMaterial

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SurfaceMaterial

Source§

fn default() -> Self

Neutral gray dielectric: base_color = [0.8, 0.8, 0.8], roughness = 0.5, metalness = 0.0, all optional textures None, all optional lobes at weight 0.0.

Source§

impl PartialEq for SurfaceMaterial

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SurfaceMaterial

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.