Skip to main content

RtMaterial

Struct RtMaterial 

Source
pub struct RtMaterial { /* private fields */ }
Expand description

Physically based ray-tracing material supporting Lambert/Oren-Nayar, GGX metal, clearcoat, dielectric glass/water with Beer-Lambert absorption, and area emission.

Implementations§

Source§

impl RtMaterial

Physical BSDF constructors, Beer-Lambert transmittance, and euv-core material converters for RtMaterial.

Source

pub fn lambert(albedo: Vec3) -> Self

Creates an ideal Lambertian matte diffuse material.

§Arguments
  • Vec3 - Linear RGB surface albedo in [0.0, 1.0].
§Returns
  • Self - Diffuse RtMaterial.
Source

pub fn oren_nayar(albedo: Vec3, sigma: f32) -> Self

Creates an Oren-Nayar micro-rough diffuse material modeling dusty or plaster surfaces.

§Arguments
  • Vec3 - Linear RGB diffuse albedo.
  • f32 - Microfacet slope standard deviation sigma in [0.0, 1.0].
§Returns
  • Self - Oren-Nayar diffuse RtMaterial.
Source

pub fn metal(albedo: Vec3, roughness: f32) -> Self

Creates a GGX microfacet metallic conductor material.

§Arguments
  • Vec3 - Linear RGB conductor reflectance F0.
  • f32 - Perceptual roughness in [0.0, 1.0].
§Returns
  • Self - Metallic conductor RtMaterial.
Source

pub fn mirror(albedo: Vec3) -> Self

Creates a sharp mirror conductor material with zero microfacet roughness.

§Arguments
  • Vec3 - Linear RGB mirror reflectance tint.
§Returns
  • Self - Ideal mirror RtMaterial.
Source

pub fn dielectric( albedo: Vec3, ior: f32, roughness: f32, absorption: Vec3, ) -> Self

Creates a refractive dielectric material (glass or water) with Schlick/Snell optics and Beer-Lambert absorption.

§Arguments
  • Vec3 - Surface transmission/reflection albedo multiplier.
  • f32 - Index of refraction (> 1.0, e.g., 1.5 for glass or 1.333 for water).
  • f32 - Surface microfacet roughness (0.0 for crystal-clear glass).
  • Vec3 - Beer-Lambert volumetric absorption coefficient sigma_a >= 0 (1 / meters).
§Returns
  • Self - Dielectric RtMaterial.
Source

pub fn glass(ior: f32) -> Self

Creates a crystal-clear lossless dielectric glass material with the given index of refraction.

§Arguments
  • f32 - Index of refraction (e.g., 1.5).
§Returns
  • Self - Clear glass RtMaterial.
Source

pub fn clearcoat( albedo: Vec3, roughness: f32, clearcoat: f32, clearcoat_roughness: f32, ) -> Self

Creates a clearcoat layered material combining a base diffuse/specular coat with a glossy dielectric varnish.

§Arguments
  • Vec3 - Base linear RGB albedo.
  • f32 - Base layer roughness in [0.0, 1.0].
  • f32 - Clearcoat weight in [0.0, 1.0].
  • f32 - Clearcoat roughness in [0.0, 1.0].
§Returns
  • Self - Principled clearcoat RtMaterial.
Source

pub fn emissive(radiance: Vec3) -> Self

Creates a pure HDR emissive area light material.

§Arguments
  • Vec3 - Linear HDR emitted radiance RGB.
§Returns
  • Self - Emissive RtMaterial.
Source

pub fn principled( albedo: Vec3, metallic: f32, roughness: f32, ior: f32, transmission: f32, ) -> Self

Creates a unified Principled BSDF material combining metallic, roughness, IOR, and transmission.

§Arguments
  • Vec3 - Base linear RGB albedo.
  • f32 - Metallic factor in [0.0, 1.0].
  • f32 - Perceptual roughness in [0.0, 1.0].
  • f32 - Dielectric IOR.
  • f32 - Transmission weight in [0.0, 1.0].
§Returns
  • Self - Principled RtMaterial.
Source

pub fn from_pbr_material(material: &PbrMaterial) -> Self

Converts an euv-core PbrMaterial into a physically based RtMaterial.

§Arguments
  • &PbrMaterial - Source World3D PBR material.
§Returns
  • Self - Converted ray-tracing material.
Source

pub fn from_principled_material(material: &PrincipledMaterial3D) -> Self

Converts an euv-core Blender/glTF PrincipledMaterial3D into a physically based RtMaterial.

§Arguments
  • &PrincipledMaterial3D - Source principled material descriptor.
§Returns
  • Self - Converted ray-tracing material including IOR, transmission, clearcoat, and Beer-Lambert volume absorption.
Source

pub fn beer_lambert_transmittance(&self, distance: f32) -> Vec3

Evaluates Beer-Lambert volumetric transmittance exp(-sigma_a * distance) over an interior ray segment.

§Arguments
  • &Self - Material reference.
  • f32 - Interior travel distance in meters.
§Returns
  • Vec3 - Component-wise optical transmittance in (0.0, 1.0].
Source

pub fn is_emissive(&self) -> bool

Returns true when this material emits non-zero HDR radiance.

§Arguments
  • &Self - Material reference.
§Returns
  • bool - Whether emission exceeds zero.
Source

pub fn is_delta_specular(&self) -> bool

Returns true when this material acts as a pure Dirac delta mirror or clear dielectric.

§Arguments
  • &Self - Material reference.
§Returns
  • bool - Whether BSDF scattering is a delta distribution.
Source§

impl RtMaterial

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_kind(&self) -> RtMaterialKind

Source

pub fn get_mut_kind(&mut self) -> &mut RtMaterialKind

Source

pub fn set_kind(&mut self, val: RtMaterialKind) -> &mut Self

Source

pub fn get_albedo(&self) -> Vec3

Source

pub fn get_mut_albedo(&mut self) -> &mut Vec3

Source

pub fn set_albedo(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_metallic(&self) -> f32

Source

pub fn get_mut_metallic(&mut self) -> &mut f32

Source

pub fn set_metallic(&mut self, val: f32) -> &mut Self

Source

pub fn get_roughness(&self) -> f32

Source

pub fn get_mut_roughness(&mut self) -> &mut f32

Source

pub fn set_roughness(&mut self, val: f32) -> &mut Self

Source

pub fn get_ior(&self) -> f32

Source

pub fn get_mut_ior(&mut self) -> &mut f32

Source

pub fn set_ior(&mut self, val: f32) -> &mut Self

Source

pub fn get_transmission(&self) -> f32

Source

pub fn get_mut_transmission(&mut self) -> &mut f32

Source

pub fn set_transmission(&mut self, val: f32) -> &mut Self

Source

pub fn get_absorption(&self) -> Vec3

Source

pub fn get_mut_absorption(&mut self) -> &mut Vec3

Source

pub fn set_absorption(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_clearcoat(&self) -> f32

Source

pub fn get_mut_clearcoat(&mut self) -> &mut f32

Source

pub fn set_clearcoat(&mut self, val: f32) -> &mut Self

Source

pub fn get_clearcoat_roughness(&self) -> f32

Source

pub fn get_mut_clearcoat_roughness(&mut self) -> &mut f32

Source

pub fn set_clearcoat_roughness(&mut self, val: f32) -> &mut Self

Source

pub fn get_emission(&self) -> Vec3

Source

pub fn get_mut_emission(&mut self) -> &mut Vec3

Source

pub fn set_emission(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_oren_nayar_sigma(&self) -> f32

Source

pub fn get_mut_oren_nayar_sigma(&mut self) -> &mut f32

Source

pub fn set_oren_nayar_sigma(&mut self, val: f32) -> &mut Self

Trait Implementations§

Source§

impl Clone for RtMaterial

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 Copy for RtMaterial

Source§

impl Debug for RtMaterial

Source§

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

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

impl Default for RtMaterial

Default matte diffuse material constructor for RtMaterial.

Source§

fn default() -> Self

Returns a neutral mid-gray Lambertian diffuse material.

§Returns
  • Self - Default diffuse material.
Source§

impl PartialEq for RtMaterial

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 RtMaterial

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<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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<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> 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.