PhongBRDF Class Reference

#include <PhongBRDF.h>

Inheritance diagram for PhongBRDF:

SpecularBRDF BRDF ESGObject List of all members.

Public Types

enum  RetVal {
  NONZERO_CONTRIB = 1, BAD_PARAMS = 2, NL_NEGATIVE = 3, NV_NEGATIVE = 4,
  NL_OR_NV_NEGATIVE = 5, ZERO_CONTRIB = 6
}

Public Member Functions

 PhongBRDF (void)
virtual RetVal reflectance (const MatVisitor &visitor, const Vector3 *L, const Vector3 *V, const Vector3 *N, Vector3 &color)
virtual RetVal reflectanceVNL (const MatVisitor &visitor, const Vector3 *L, const Vector3 *V, const Vector3 *N, double NV, double NL, Vector3 &color)
virtual RetVal reflectanceNL (const MatVisitor &visitor, const Vector3 *L, const Vector3 *V, const Vector3 *N, double NL, Vector3 &color)
virtual BRDFclone (void) const
virtual double albedo (const MatVisitor &visitor, const Vector3 &N, const Vector3 *V) const
virtual void importanceSample (const MatVisitor &visitor, const Vector3 &D, double r1, double r2, Vector3 &dir, double *pPDFVal)
virtual Vector2 dir2uv (const MatVisitor &visitor, const Vector3 &N, const Vector3 &D) const
 _isIsotropic (isotropic)
bool diffuse (void) const
bool specular (void) const
bool isotropic (void) const
bool anisotropic (void) const

Public Attributes

 __pad0__: _isDiffuse(diffuse)

Protected Member Functions

virtual void _duplicate_attributes (const BRDF &src)

Protected Attributes

bool _isDiffuse
bool _isIsotropic

Detailed Description

Phong's specular BRDF (without diffuse and ambient components).

$ BRDF = k_s \frac{\cos^r{\alpha}}{\cos{\theta}} = k_s \frac{(R*V)^r}{(L*N)} $

Definition at line 24 of file PhongBRDF.h.


Member Enumeration Documentation

enum RetVal [inherited]
 

Informations about reflectance

Enumerator:
NONZERO_CONTRIB  color is set (including black)
BAD_PARAMS  unable to compute reflectance
NL_NEGATIVE  dot-product of normal, N, and light direction, L, is less than zero
NV_NEGATIVE  dot-product of normal, N, and viewer direction, V, is less than zero
NL_OR_NV_NEGATIVE  either N*L or N*V is less than zero
ZERO_CONTRIB  no energy is reflected in given direction

Definition at line 22 of file BRDF.h.


Constructor & Destructor Documentation

PhongBRDF void   )  [inline]
 

Constructor

Definition at line 34 of file PhongBRDF.h.


Member Function Documentation

virtual void _duplicate_attributes const BRDF src  )  [inline, protected, virtual]
 

Reimplemented from SpecularBRDF.

Definition at line 26 of file PhongBRDF.h.

References SpecularBRDF::_duplicate_attributes().

_isIsotropic isotropic   )  [inline, inherited]
 

Definition at line 51 of file BRDF.h.

virtual double albedo const MatVisitor visitor,
const Vector3 N,
const Vector3 V
const [inline, virtual]
 

Albedo for importance sampling strategies.

Parameters:
visitor visitor of material coefficients
N normalized normal vector
V normalized direction to viewer
Returns:
$ albedo = 2 \pi \frac{avg(k_s)}{(r+2) \cos{\theta}} $, where $avg()$ is average of specular material components and $r$ is roughness.

Implements SpecularBRDF.

Definition at line 108 of file PhongBRDF.h.

References MatVisitor::avgSpecular(), MatVisitor::intRoughness(), and PI.

Referenced by CookTorranceBRDF::albedo(), and BlinnBRDF::albedo().

bool anisotropic void   )  const [inline, inherited]
 

Returns:
true if BRDF is anisotropic (reflectance dependents on rotation around normal), false otherwise

Definition at line 80 of file BRDF.h.

virtual BRDF* clone void   )  const [inline, virtual]
 

Duplicates the BRDF

Implements SpecularBRDF.

Definition at line 96 of file PhongBRDF.h.

bool diffuse void   )  const [inline, inherited]
 

Returns:
true if BRDF is diffuse, false otherwise

Definition at line 61 of file BRDF.h.

virtual Vector2 dir2uv const MatVisitor visitor,
const Vector3 N,
const Vector3 D
const [inline, virtual]
 

Gets direction in global coords and returns its generating "random" numbers (i.e. the inverse function to importanceSample()).

Parameters:
visitor not used
N normalized normal vector
D normalized direction
Returns:
"random" numbers generating direction D; x item of returned vector corresponds to r1 of importanceSample() method, y item corresponds to r2; $ (u,v) = (\sin^{r+1}\theta, \frac{\phi}{2 \pi})$

Implements SpecularBRDF.

Definition at line 157 of file PhongBRDF.h.

References Hemisphere::dir2uvPriorToPoweredZenith(), and MatVisitor::intRoughness().

Referenced by BlinnBRDF::dir2uv().

virtual void importanceSample const MatVisitor visitor,
const Vector3 D,
double  r1,
double  r2,
Vector3 dir,
double *  pPDFVal
[inline, virtual]
 

Point sampling interface - importance sampling. This method gets two random numbers and preffered direction of random sample and selects amd returns random direction.

$ (\theta, \phi) = (\arcsin({(1-r_1)^{\frac{1}{r+1}}}), 2 \pi r_2) $ where $r$ is roughness

Parameters:
visitor visitor of material coefficients
D normalized vector determining prefered direction of the sample
r1 random number from the range [0,1)
r2 random number from the range [0,1)
dir random direction selected by this method ($ (\theta,\phi) $ transformed to the world coodinates)
pPDFVal corresponding PDF value, $ PDF = (r+1) \frac{\cos^r{\theta}}{2 \pi} $

Implements SpecularBRDF.

Definition at line 133 of file PhongBRDF.h.

References MatVisitor::intRoughness(), and Hemisphere::samplePriorToPoweredZenith().

Referenced by CookTorranceBRDF::importanceSample(), and BlinnBRDF::importanceSample().

bool isotropic void   )  const [inline, inherited]
 

Returns:
true if BRDF is isotropic (reflectance is independent of rotation around normal), false otherwise

Definition at line 73 of file BRDF.h.

virtual RetVal reflectance const MatVisitor visitor,
const Vector3 L,
const Vector3 V,
const Vector3 N,
Vector3 color
[inline, virtual]
 

Computes and returns actual reflectance.

Parameters:
visitor visitor of material coefficients
L normalized direction to light source
V normalized direction to viewer
N normalized normal vector
color computed reflected energy (color)
Returns:
additionnal informations about reflected energy

Implements SpecularBRDF.

Definition at line 36 of file PhongBRDF.h.

References MatVisitor::intRoughness(), and MatVisitor::specular().

virtual RetVal reflectanceNL const MatVisitor visitor,
const Vector3 L,
const Vector3 V,
const Vector3 N,
double  NL,
Vector3 color
[inline, virtual]
 

Computes and returns actual reflectance. This variant speeds up the computation using given precomputed dot-product of N and L

Parameters:
visitor visitor of material coefficients
L normalized direction to light source
V normalized direction to viewer
N normalized normal vector
NL precomputed dot-product of normal N and L
color computed reflected energy (color)
Returns:
additionnal informations about reflected energy

Implements SpecularBRDF.

Definition at line 77 of file PhongBRDF.h.

References MatVisitor::intRoughness(), and MatVisitor::specular().

virtual RetVal reflectanceVNL const MatVisitor visitor,
const Vector3 L,
const Vector3 V,
const Vector3 N,
double  NV,
double  NL,
Vector3 color
[inline, virtual]
 

Computes and returns actual reflectance. This variant speeds up the computation using given precomputed dot-products of N, V and L

Parameters:
visitor visitor of material coefficients
L normalized direction to light source
V normalized direction to viewer
N normalized normal vector
NV precomputed dot-product of normal N and V
NL precomputed dot-product of normal N and L
color computed reflected energy (color)
Returns:
additionnal informations about reflected energy

Implements SpecularBRDF.

Definition at line 57 of file PhongBRDF.h.

References MatVisitor::intRoughness(), and MatVisitor::specular().

bool specular void   )  const [inline, inherited]
 

Returns:
true if BRDF is specular, false otherwise

Definition at line 66 of file BRDF.h.


Member Data Documentation

__pad0__ [inherited]
 

Contructor

Parameters:
diffuse determines whether this BRDF is diffuse (reflectance is independent of viewer direction)
isotropic determines whether this BRDF is isotropic (reflectance is independent of rotation around normal)

Definition at line 51 of file BRDF.h.

bool _isDiffuse [protected, inherited]
 

Definition at line 32 of file BRDF.h.

Referenced by BRDF::_duplicate_attributes().

bool _isIsotropic [protected, inherited]
 

Definition at line 33 of file BRDF.h.

Referenced by BRDF::_duplicate_attributes().


The documentation for this class was generated from the following file:
Generated on Wed Jun 28 12:24:33 2006 for esg by  doxygen 1.4.6