BSDF Class Reference

Abstract representation of a BSDF defined at a single point on a surface in 3-space. More...

#include <BSDF.h>

Inheritance diagram for BSDF:

Sampler SSEAligned AbsorbentBSDF AggregateBSDF DielectricBSDF DiffuseBSDF Emitter ModifiedPhongBSDF Sensor EnvironmentMap NullEmitter OmniEmitter OrientedEmitter NullSensor

List of all members.

Public Member Functions

Constructors
 BSDF (SurfacePoint &pt, Material *parent=NULL)
virtual ~BSDF ()
Initialization
virtual void init ()
 Performs any initialization that may be necessary before beginning to sample this BSDF.
Main usage interface
virtual void setWi (const Vector3 &wi)
 Sets the incident vector, wi, for this BSDF. All BSDF sampling is with respect to the current value of wi.
virtual Event sample ()=0
 Samples an exitent vector at the given surface point.
virtual real_t getPdf (const Event &event)=0
SpectralSampleSet getBSDF (const Vector3 &wo)
 Evaluates the spectral BSDF at the given surface point with respect to the out vector, 'wo', at the underlying surface point and given incident vector, 'wi'.
virtual SpectralSampleSet getBSDF (const Vector3 &wi, const Vector3 &wo)=0
 Evaluates the spectral BSDF at the given surface point with respect to the out vector, 'wo', at the underlying surface point and given incident vector, 'wi'.
bool isSpecular () const
virtual bool isSpecular (Event &) const
virtual void preview (Shape *shape)
 Sets up OpenGL material state (color properties, etc.) to enable a crude/fast preview of geometry to which this BSDF is applied.
Accessors/Mutators
SurfacePointgetSurfacePoint ()
const Vector3getWi () const
MaterialgetParent ()
Vector3 getSpecularReflection () const

Protected Attributes

Vector3 m_wi
SurfacePointm_pt
Materialm_parent


Detailed Description

Abstract representation of a BSDF defined at a single point on a surface in 3-space.

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008
A BSDF (or Bidirectional Scattering Distribution Function) is a function defining the fraction of light propagated after hitting a surface in a given exitent direction, wo, from a given incident direction, wi. It represents the observed radiance leaving in direction wo, per unit of irradiance arriving from wi. A BSDF is commonly denoted by the notation fs(wi->wo). It is much more common in computer graphics to hear one speak about BRDFs (or Bidirectional Reflectance Distribution Functions), the difference being that BSDFs are defined over the entire sphere of solid angles and therefore include transmission (transparency), whereas BRDFs are defined only on the positive hemisphere at a surface point with respect to its local geometric normal. BRDFs represent a subset of allowable BSDFs, and they suffice in simulating the majority of real world materials. The added complexity / generality of BSDFs, however, is important to any physically based rendering engine such as Milton. A BRDF is commonly denoted by fr(wi->wo).

Physically valid BRDFs have several basic properties or consraints, namely reciprocity and conservation of energy. Reciprocity means that BRDFs are symmetric: fr(wi->wo) = fr(wo->wi). For this reason, it is common to make the symmetric explicit in the notation by instead writing fr(wi<->wo) in the case of BRDFs or fs(wi<->wo) in the case of BSDFs. Conservation of energy states that a surface should not reflect more energy than it receives. Formally this can be stated as the integral of fr(wi->wo) over the positive hemisphere at any point with respect to a projected solid angle measure has to be less than or equal to one for all possible incident vectors, wi.

Example usage:


      SurfacePoint pt;
      const real_t t = m_scene->getIntersection(ray, pt);
      
      // lazily initialize SurfacePoint and return if no intersection
      if (!pt.init(ray, t))
         return; // ray didn't hit anything (t == INFINITY)
      
      // sample the BSDF for an exitant direction
      const Event &event = pt.bsdf->sample();
      const Vector3 &wo  = event;
      
      if (wo == Vector3::zero())
         return; // invalid exitant direction
      
      // evaluate BSDF in the given exitant direction and divide by probability
      // with which we sampled that direction
      const real_t pdf = pt.bsdf->getPdf(event);
      const SpectralSampleSet &fs = pt.bsdf->getBSDF(wo) / pdf;
      
      // ... trace another ray in direction 'wo' ...
   

Definition at line 78 of file BSDF.h.


Constructor & Destructor Documentation

BSDF::BSDF ( SurfacePoint pt,
Material parent = NULL 
) [inline, explicit]

Definition at line 83 of file BSDF.h.

virtual BSDF::~BSDF (  )  [inline, virtual]

Definition at line 87 of file BSDF.h.


Member Function Documentation

virtual void BSDF::init (  )  [inline, virtual]

Performs any initialization that may be necessary before beginning to sample this BSDF.

Note:
default implementation is empty

Reimplemented from Sampler.

Reimplemented in AggregateBSDF, DielectricBSDF, ModifiedPhongBSDF, Emitter, EnvironmentMap, NullEmitter, Sensor, and NullSensor.

Definition at line 102 of file BSDF.h.

virtual void BSDF::setWi ( const Vector3 wi  )  [inline, virtual]

Sets the incident vector, wi, for this BSDF. All BSDF sampling is with respect to the current value of wi.

Reimplemented in AggregateBSDF, and OrientedEmitter.

Definition at line 115 of file BSDF.h.

virtual Event BSDF::sample (  )  [pure virtual]

Samples an exitent vector at the given surface point.

Returns:
the sampled vector as a Vector3 wrapped in an Event object
Note:
returns Vector3::zero() if no exitent vector was sampled (to model a certain probability of absorption, for instance)
Example usage:

    const Event &event = bsdf.sample();
    const Vector3 &wo  = event.getValue();
    const real_t pd    = bsdf.getPdf(event);        // p(x) probability
    const SpectralSampleSet &fs = bsdf.getBSDF(wo); // f(x) reflectivity
 

Implements Sampler.

Implemented in AbsorbentBSDF, AggregateBSDF, DielectricBSDF, DiffuseBSDF, ModifiedPhongBSDF, Emitter, Sensor, and NullSensor.

virtual real_t BSDF::getPdf ( const Event event  )  [pure virtual]

Returns:
the probability density of having sampled the given out out vector event with respect to whatever underlying sampling strategy is being used to sample the BSDF
Note:
probability density is assumed to be with respect to projected solid angle (the conversion from solid angle to projected solid angle involves dividing the solid angle density by the absolute value of the cosine of the angle between the local surface normal and the exitant vector in event)

Implements Sampler.

Implemented in AbsorbentBSDF, AggregateBSDF, DielectricBSDF, DiffuseBSDF, ModifiedPhongBSDF, Emitter, Sensor, and NullSensor.

SpectralSampleSet BSDF::getBSDF ( const Vector3 wo  )  [inline]

Evaluates the spectral BSDF at the given surface point with respect to the out vector, 'wo', at the underlying surface point and given incident vector, 'wi'.

Returns:
the spectral radiance leaving in direction wo, per unit of irradiance arriving from wi (unitless fraction in [0, 1])
Note:
uses the currently set m_wi for the incident vector

Definition at line 163 of file BSDF.h.

virtual SpectralSampleSet BSDF::getBSDF ( const Vector3 wi,
const Vector3 wo 
) [pure virtual]

Evaluates the spectral BSDF at the given surface point with respect to the out vector, 'wo', at the underlying surface point and given incident vector, 'wi'.

Returns:
the spectral radiance leaving in direction wo, per unit of irradiance arriving from wi (unitless fraction in [0, 1])

Implemented in AbsorbentBSDF, AggregateBSDF, DielectricBSDF, DiffuseBSDF, ModifiedPhongBSDF, Emitter, Sensor, and NullSensor.

bool BSDF::isSpecular (  )  const [inline]

Returns:
true iff this BSDF is non-zero over a set of solid angles with measure zero (measured with respect to solid angle)
Note:
a perfectly specular material has a dirac distribution for its reflectance, and therefore needs special consideration when sampling the BRDF for simulation purposes

the default implementation returns false because perfectly specular surfaces don't occur that often in real life, though they abound in computer graphics (due to their ease of simulation)

Definition at line 190 of file BSDF.h.

virtual bool BSDF::isSpecular ( Event  )  const [inline, virtual]

Returns:
true iff this BSDF is non-zero over a set of solid angles with measure zero (measured with respect to solid angle)
Note:
a perfectly specular material has a dirac distribution for its reflectance, and therefore needs special consideration when sampling the BRDF for simulation purposes

the default implementation returns false because perfectly specular surfaces don't occur that often in real life, though they abound in computer graphics (due to their ease of simulation)

implementations are free to use the given Event's metadata to determine whether or not it represents a specular event

Reimplemented in AggregateBSDF, DielectricBSDF, and Sensor.

Definition at line 208 of file BSDF.h.

void BSDF::preview ( Shape shape  )  [virtual]

Sets up OpenGL material state (color properties, etc.) to enable a crude/fast preview of geometry to which this BSDF is applied.

Note:
default implementation sets the current glColor
Parameters:
shape is the Shape which this BSDF will preview itself on

Reimplemented in Emitter, EnvironmentMap, NullEmitter, and Sensor.

Definition at line 72 of file BSDF.cpp.

SurfacePoint& BSDF::getSurfacePoint (  )  [inline]

Returns:
the SurfacePoint at which this BSDF instance is defined

Reimplemented in Emitter, and Sensor.

Definition at line 230 of file BSDF.h.

const Vector3& BSDF::getWi (  )  const [inline]

Returns:
the current incident vector, wi, for which this BSDF will be sampled

Definition at line 238 of file BSDF.h.

Material* BSDF::getParent (  )  [inline]

Returns:
the parent Material which instantiated this BSDF
Note:
the parent Material is also a PropertyMap and contians all key-value inputs to this BSDF

Reimplemented in Emitter, and Sensor.

Definition at line 248 of file BSDF.h.

Vector3 BSDF::getSpecularReflection (  )  const [inline]

Returns:
the perfect specularly reflected direction given the current incident vector, wi, which is defined to be wi rotated about the local surface normal
See also:
also Vector::reflectVector

Definition at line 259 of file BSDF.h.


Member Data Documentation

Vector3 BSDF::m_wi [protected]

Definition at line 267 of file BSDF.h.

SurfacePoint& BSDF::m_pt [protected]

Reimplemented in Emitter, and Sensor.

Definition at line 268 of file BSDF.h.

Material* BSDF::m_parent [protected]

Reimplemented in Emitter, and Sensor.

Definition at line 269 of file BSDF.h.


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

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6