Trait BSDF

Source
pub trait BSDF {
    // Required methods
    fn sample_incoming(
        &self,
        omega_o: Vec3d,
        rdf: Vec3d,
    ) -> SampleIncomingResponse;
    fn evaluate(&self, omega_o: Vec3d, omega_i: Vec3d) -> RgbD;
    fn sample_incoming_pdf(&self, omega_o: Vec3d, omega_i: Vec3d) -> f64;
    fn base_color(&self, omega_o: Vec3d) -> RgbD;

    // Provided methods
    fn sample_outgoing(
        &self,
        omega_i: Vec3d,
        rdf: Vec3d,
    ) -> SampleOutgoingResponse { ... }
    fn sample_outgoing_pdf(&self, omega_o: Vec3d, omega_i: Vec3d) -> f64 { ... }
    fn emission(&self, omega_o: Vec3d) -> RgbD { ... }
    fn sample_emission_pdf(&self, omega_o: Vec3d) -> f64 { ... }
    fn sample_emission(&self, _rdf: Vec2d) -> SampleEmissionResponse { ... }
}
Expand description

Bidirectional Scattering Distribution Functions. A trait that describes the surface properties of a material if you will.

This trait contains functions to importance sample and evaluate a specific BSDF

Required Methods§

Source

fn sample_incoming(&self, omega_o: Vec3d, rdf: Vec3d) -> SampleIncomingResponse

Given a direction where light is scattered to, samples an incident direction, from which the light may come from

§Arguments
  • omega_o - The direction where light is scattered to. Outgoing direction
  • rd - A random distribution for sampling
§Return

See SampleIncomingResponse

Source

fn evaluate(&self, omega_o: Vec3d, omega_i: Vec3d) -> RgbD

Returns the value of the BSDF at the given directions

§Arguments
  • omega_o - Exitant light direction
  • omega_i - Incident light direction
Source

fn sample_incoming_pdf(&self, omega_o: Vec3d, omega_i: Vec3d) -> f64

Returns the probability density sampling an incoming direction given an outgoing direction See BSDF::sample_incoming and SampleIncomingResponse

Source

fn base_color(&self, omega_o: Vec3d) -> RgbD

Returns the base color of the surface. This function is used to generate auxiliary images for AI tools such as Open Image Denoise

Provided Methods§

Source

fn sample_outgoing(&self, omega_i: Vec3d, rdf: Vec3d) -> SampleOutgoingResponse

Given an incident light direction, samples a direction where light is scattered to

§Arguments
  • omega_i - A direction where light is coming from
  • surface - The properties of the surface at a given point
  • rd - A random distribution for sampling
§Return

See SampleOutgoingResponse

Source

fn sample_outgoing_pdf(&self, omega_o: Vec3d, omega_i: Vec3d) -> f64

Returns the probability density sampling an outgoing direction given an incoming direction See BSDF::sample_outgoing_pdf and SampleOutgoingResponse

Source

fn emission(&self, omega_o: Vec3d) -> RgbD

Returns how much light is emitted to the given direction omega_o

Source

fn sample_emission_pdf(&self, omega_o: Vec3d) -> f64

Returns the probability density of choosing the given direction when sampled with BSDF::sample_emission Returns 0.0 if the surface does not emit light

Source

fn sample_emission(&self, _rdf: Vec2d) -> SampleEmissionResponse

Samples a direction in which light is emitted to and also returns the amount of emission The returned vector is the null vector, if this surface does not emit any light See also: SampleEmissionResponse

Implementors§

Source§

impl BSDF for Conductive

Source§

impl BSDF for Disney

Source§

impl BSDF for Emissive

Source§

impl BSDF for Lambert

Source§

impl BSDF for RoughGlass

Source§

impl<B1, B2> BSDF for Mix<B1, B2>
where B1: BSDF, B2: BSDF,