Arty
Public Types | Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Bsdf Class Reference

Base class for BSDFs. More...

#include <materials.h>

Inheritance diagram for Bsdf:
CombineBsdf DiffuseBsdf GlassBsdf GlossyPhongBsdf MirrorBsdf

Public Types

enum  Type { Type::Diffuse = 0, Type::Glossy = 1, Type::Specular = 2 }
 Classification of BSDF shapes. More...
 

Public Member Functions

 Bsdf (Type ty)
 
Type type () const
 Returns the type of the BSDF, useful to make sampling decisions.
 
virtual rgb eval (const float3 &, const SurfaceParams &, const float3 &) const
 Evaluates the material for the given pair of directions and surface point. Does NOT include the cosine term.
 
virtual BsdfSample sample (Sampler &, const SurfaceParams &surf, const float3 &, bool=false) const
 Samples the material given a surface point and an outgoing direction. The contribution DOES include the cosine term.
 
virtual float pdf (const float3 &, const SurfaceParams &, const float3 &) const
 Returns the probability to sample the given input direction (sampled using the sample function).
 

Static Protected Member Functions

template<bool below_surface = false>
static BsdfSample make_sample (const float3 &dir, float pdf, const rgb &color, const SurfaceParams &surf)
 

Protected Attributes

Type ty
 

Detailed Description

Base class for BSDFs.

Member Enumeration Documentation

◆ Type

enum Bsdf::Type
strong

Classification of BSDF shapes.

Enumerator
Diffuse 

Mostly diffuse, i.e no major features, mostly uniform.

Glossy 

Mostly glossy, i.e hard for Photon Mapping.

Specular 

Purely specular, i.e merging/connections are not possible.

Member Function Documentation

◆ make_sample()

template<bool below_surface = false>
static BsdfSample Bsdf::make_sample ( const float3 dir,
float  pdf,
const rgb color,
const SurfaceParams surf 
)
inlinestaticprotected

Utility function to create a MaterialSample. It prevents corner cases that will cause issues (zero pdf, direction parallel/under the surface). When below_surface is true, it expects the direction to be under the surface, otherwise above.


The documentation for this class was generated from the following file: