BSDF Class Reference
Abstract representation of a BSDF defined at a single point on a surface in 3-space. More...
#include <BSDF.h>

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 | |
| SurfacePoint & | getSurfacePoint () |
| const Vector3 & | getWi () const |
| Material * | getParent () |
| Vector3 | getSpecularReflection () const |
Protected Attributes | |
| Vector3 | m_wi |
| SurfacePoint & | m_pt |
| Material * | m_parent |
Detailed Description
Abstract representation of a BSDF defined at a single point on a surface in 3-space.
- Date:
- Fall 2008
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] |
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.
| 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.
| 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)
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.
- Returns:
- the probability density of having sampled the given out out vector
eventwith 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
| 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)
| 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.
| 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
Reimplemented in Emitter, EnvironmentMap, NullEmitter, and Sensor.
| SurfacePoint& BSDF::getSurfacePoint | ( | ) | [inline] |
| const Vector3& BSDF::getWi | ( | ) | const [inline] |
| Material* BSDF::getParent | ( | ) | [inline] |
| 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
Member Data Documentation
Vector3 BSDF::m_wi [protected] |
SurfacePoint& BSDF::m_pt [protected] |
Material* BSDF::m_parent [protected] |
The documentation for this class was generated from the following files:
Generated on 28 Feb 2009 for Milton by
1.5.6