Class bsdf_t

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class bsdf_t : public wt::scene::scene_element_t

Generic BSDF interface. BSDFs (bi-directional scattering distribution functions) quantify the interaction of light with an interface.

Subclassed by wt::bsdf::composite_t, wt::bsdf::dielectric_t, wt::bsdf::diffuse_t, wt::bsdf::mask_t, wt::bsdf::normalmap_t, wt::bsdf::scale_t, wt::bsdf::surface_spm_t, wt::bsdf::two_sided_t

Public Functions

inline bsdf_t(std::string id)
bsdf_t(bsdf_t&&) = default
virtual ~bsdf_t() noexcept = default
inline virtual frame_t shading_frame(const texture::texture_query_t &tquery, const mesh::surface_differentials_t &tangent_frame, const dir3_t &ns) const noexcept

Constructs a shading frame in world space. This is useful for BSDFs that perturb the shading frame, like normal or bump maps.

Parameters:
  • tquery – texture query data.

  • tangent_frame – mesh tangent frame at intersection.

  • ns – interpolated shading normal at intersection.

virtual std::optional<f_t> albedo(wavenumber_t k) const noexcept = 0

Spectral albedo. Returns std::nullopt when albedo cannot be computed.

Parameters:

k – wavenumber

virtual lobe_mask_t lobes(wavenumber_t k) const noexcept = 0

Returns mask of all available lobes for this BSDF at particular wavenumber.

inline int lobe_count(wavenumber_t k) const noexcept

Returns count of lobes for this BSDF at particular wavenumber.

virtual bool is_delta_only(wavenumber_t k) const noexcept = 0

Does this BSDF comprise of only delta lobes?

virtual bool is_delta_lobe(wavenumber_t k, std::uint32_t lobe) const noexcept = 0

Is a lobe a delta lobe?

inline virtual bool needs_interaction_footprint() const noexcept

Returns true for BSDF that make use of the surface interaction footprint data.

virtual bsdf_result_t f(const dir3_t &wi, const dir3_t &wo, const bsdf_query_t &query) const noexcept = 0

Evaluates the BSDF. Accounts for the cosine foreshortening term. Only non-delta lobes are evaluated.

Parameters:
  • wi – incident direction (in local frame)

  • wo – exitant direction (in local frame)

Returns:

the polarimetric interaction, quantified by a Mueller matrix; see wt::bsdf::bsdf_result_t. Note: the return has implied units of 1/sr.

virtual std::optional<bsdf_sample_t> sample(const dir3_t &wi, const bsdf_query_t &query, sampler::sampler_t &sampler) const noexcept = 0

Samples the BSDF.

Parameters:

wi – incident direction (in local frame)

virtual solid_angle_density_t pdf(const dir3_t &wi, const dir3_t &wo, const bsdf_query_t &query) const noexcept = 0

Provides the sample solid angle density of non-delta lobes.

Parameters:
  • wi – incident direction (in local frame)

  • wo – exitant direction (in local frame)

virtual f_t eta(const dir3_t &wi, const dir3_t &wo, const wavenumber_t k) const noexcept = 0

Computes the refractive-index ratio: eta at exit / eta at entry.

Parameters:
  • wi – incident direction (in local frame)

  • wo – exitant direction (in local frame)

  • k – wavenumber

virtual scene::element::info_t description() const override = 0

Public Static Functions

static inline constexpr std::string scene_element_class() noexcept
static std::unique_ptr<bsdf_t> load(std::string id, scene::loader::loader_t *loader, const scene::loader::node_t &node, const wt::wt_context_t &context)