pub struct PbrLighting;Expand description
Cook-Torrance PBR BRDF evaluated on the CPU.
All values are in linear light-space. Apply sRGB gamma after.
Implementations§
Source§impl PbrLighting
impl PbrLighting
Sourcepub fn fresnel_schlick(cos_theta: f32, f0: Vec3) -> Vec3
pub fn fresnel_schlick(cos_theta: f32, f0: Vec3) -> Vec3
Schlick Fresnel approximation.
Sourcepub fn geometry_schlick_ggx(n_dot_v: f32, roughness: f32) -> f32
pub fn geometry_schlick_ggx(n_dot_v: f32, roughness: f32) -> f32
Schlick-GGX geometry function (one direction).
Sourcepub fn geometry_smith(n_dot_v: f32, n_dot_l: f32, roughness: f32) -> f32
pub fn geometry_smith(n_dot_v: f32, n_dot_l: f32, roughness: f32) -> f32
Smith geometry function (both view and light).
Sourcepub fn brdf(
normal: Vec3,
view_dir: Vec3,
light_dir: Vec3,
mat: &PbrMaterial,
) -> Vec3
pub fn brdf( normal: Vec3, view_dir: Vec3, light_dir: Vec3, mat: &PbrMaterial, ) -> Vec3
Full Cook-Torrance BRDF for a single punctual light.
Sourcepub fn shade(
position: Vec3,
normal: Vec3,
view_pos: Vec3,
mat: &PbrMaterial,
manager: &LightManager,
) -> Vec3
pub fn shade( position: Vec3, normal: Vec3, view_pos: Vec3, mat: &PbrMaterial, manager: &LightManager, ) -> Vec3
Evaluate the full PBR lighting equation at a surface point.
Sourcepub fn shade_sss(
position: Vec3,
normal: Vec3,
view_pos: Vec3,
mat: &PbrMaterial,
manager: &LightManager,
) -> Vec3
pub fn shade_sss( position: Vec3, normal: Vec3, view_pos: Vec3, mat: &PbrMaterial, manager: &LightManager, ) -> Vec3
Evaluate subsurface scattering contribution (simple wrapping model).
Auto Trait Implementations§
impl Freeze for PbrLighting
impl RefUnwindSafe for PbrLighting
impl Send for PbrLighting
impl Sync for PbrLighting
impl Unpin for PbrLighting
impl UnsafeUnpin for PbrLighting
impl UnwindSafe for PbrLighting
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.