PhotonMapping Class Reference

#include <PhotonMapping.h>

Inheritance diagram for PhotonMapping:

PathTracing RayTracing ReflectionModel GRAObject List of all members.

Public Member Functions

 PhotonMapping (AutoPtr< LocalReflection > *r=NULL, const Color3f &bg=Color3f(0, 0, 0), Intersector *i=NULL, unsigned d=1, float w=.001, float f=REFR_AIR, unsigned p=1, unsigned ps=1, unsigned e=20, float m=sqrt(FLT_MAX-1), unsigned pr=2, double pd=.05, int st=GLOBAL_ILLUMINATION, bool il=true, unsigned er=10, bool ci=true)
virtual Color3f * illuminatePoint (PointEnv &)
virtual void setScene (Scene *s)
virtual void setDiffuseBRDF (DiffuseBRDF *b)
virtual void setSpecularBRDF (SpecularBRDF *b)
virtual void setEmittance (Emittance *e)
void setIntersector (Intersector *i)

Static Public Attributes

static const int DIRECT_ILLUMINATION = (1<<0)
static const int SPECULAR_REFLECTION = (1<<1)
static const int CAUSTICS = (1<<2)
static const int INDIRECT_ILLUMINATION = (1<<3)
static const int GLOBAL_ILLUMINATION
static const unsigned PARTITIONING = 30
static const unsigned PARTITIONING_2 = PARTITIONING * PARTITIONING
static const double ANTIBIAS_FRACTION = .001

Protected Types

enum  RefrDir { REFR_DIR_REFLECTION, REFR_DIR_REFRACTION }

Protected Member Functions

bool _interpolate_irradiance (const vector< IrradianceCache::Value * > &, Color3f &)
double * _power_square (const vector< Photon * > &, const Vector3 &, BRDF &, const MatVisitor &, double &)
double _importance_sampling (const Vector3 &, BRDF &, const MatVisitor &, double *, double, Vector3 &)
virtual void _sample_diffuse (PointEnv &, unsigned, bool, Color3f &, MatVisitor &)
virtual void _sample_specular (PointEnv &, unsigned, bool, Color3f &, MatVisitor &)
virtual void _cast_secondary_rays (PointEnv &, unsigned, bool, Color3f &, MatVisitor &)
virtual void _illuminate (PointEnv &, unsigned, bool, Color3f &)
virtual void _cast_the_ray (PointEnv &, unsigned, bool, Color3f &, const Vector3 &, const Vector3 &)
void _check_point_of_intersection (PointEnv &) const
MatVisitor * _check_material (SceneGraphObject *, bool)
PointEnv * _cast_ray (const Vector3 &, const Vector3 &)
void _apply_texture (PointEnv &, Color3f &)
void _apply_texture (PointEnv &, Vector3 &)
void _direct_illumination (PointEnv &, MatVisitor &, unsigned, Color3f &)
RefrDir _refraction_dir (PointEnv &, MatVisitor &, bool, Vector3 &)
void _reflection_dir (PointEnv &, Vector3 &)

Protected Attributes

unsigned _photonsPerSpecularSurface
unsigned _numPhotonsToEst
float _maxDistToEst
unsigned _preciseIllumRefl
double _preciseIllumDist
int _illumStage
bool _incomingLighting
unsigned _maxError
bool _cacheIrradiance
double _sceneDistance
unsigned _specReflections
bool _diffReflection
const PhotonMap * _pGlobalMap
const PhotonMap * _pCausticsMap
IrradianceCache * _pIrradCache
unsigned _photonsPerSurface
AutoPtr< LocalReflection > * _pAReflection
Color3f _background
Intersector * _pIntersector
unsigned _maxDepth
float _minRayWeight
float _defaultMediumRefraction
LocalReflection_pLocalReflection
RayIntExplorer _riExplorer
Texture * _pTexture
Sgi::hash_map< SceneGraphObject::OID,
MatVisitor * > 
_matCache
DiffuseBRDF * _pDiffuseBRDF
SpecularBRDF * _pSpecularBRDF
Emittance * _pEmittance
Scene_pScene

Detailed Description

Definition at line 20 of file PhotonMapping.h.


Member Enumeration Documentation

enum RefrDir [protected, inherited]
 

Enumerator:
REFR_DIR_REFLECTION 
REFR_DIR_REFRACTION 

Definition at line 48 of file RayTracing.h.


Constructor & Destructor Documentation

PhotonMapping AutoPtr< LocalReflection > *  r = NULL,
const Color3f &  bg = Color3f(0,0,0),
Intersector *  i = NULL,
unsigned  d = 1,
float  w = .001,
float  f = REFR_AIR,
unsigned  p = 1,
unsigned  ps = 1,
unsigned  e = 20,
float  m = sqrt(FLT_MAX-1),
unsigned  pr = 2,
double  pd = .05,
int  st = GLOBAL_ILLUMINATION,
bool  il = true,
unsigned  er = 10,
bool  ci = true
[inline]
 

Parameters:
r local reflecton model for direct illumination
bg background color of scene
i ray intersector computing the closest intersection
d maximal depth of recursion
w minimal weight of rays during recursion
f default refraction coefficient
p number of rays casted during the Monte Carlo integration on diffuse surfaces
ps number of rays casted during the Monte Carlo integration on specular surfaces
e max. number of photons retrieved from photon map
m max. distance of photons retrieved from photon map
pr max. number of specular reflections in recursion until the precise computation is done
pd max. distance for precise computation
st which illumination stage(s) perform
il whether to use importance sampling in accord to incomming lighting
er max. allowed error on irradiance estimate; the bigger value, the thicker irradiance cache
ci whether to use irradiance caching

Definition at line 118 of file PhotonMapping.h.


Member Function Documentation

void _apply_texture PointEnv &  ,
Vector3 & 
[protected, inherited]
 

Definition at line 116 of file RayTracing.cc.

References RayTracing::_pTexture.

void _apply_texture PointEnv &  ,
Color3f & 
[protected, inherited]
 

Definition at line 84 of file RayTracing.cc.

References RayTracing::_pTexture.

Referenced by RayTracing::_cast_secondary_rays(), and RayTracing::_direct_illumination().

PointEnv * _cast_ray const Vector3 &  ,
const Vector3 & 
[protected, inherited]
 

Definition at line 53 of file RayTracing.cc.

References RayTracing::_pIntersector, ReflectionModel::_pScene, RayTracing::_riExplorer, and Scene::root().

Referenced by RayTracing::_cast_secondary_rays(), and PathTracing::_cast_the_ray().

virtual void _cast_secondary_rays PointEnv &  ,
unsigned  ,
bool  ,
Color3f &  ,
MatVisitor & 
[inline, protected, virtual]
 

Reimplemented from PathTracing.

Definition at line 86 of file PhotonMapping.h.

void _cast_the_ray PointEnv &  ,
unsigned  ,
bool  ,
Color3f &  ,
const Vector3 &  ,
const Vector3 & 
[protected, virtual, inherited]
 

Definition at line 6 of file PathTracing.cc.

References RayTracing::_background, RayTracing::_cast_ray(), RayTracing::_illuminate(), and RayTracing::_minRayWeight.

Referenced by PathTracing::_cast_secondary_rays(), and PhotonMapping::_sample_specular().

MatVisitor * _check_material SceneGraphObject *  ,
bool 
[protected, inherited]
 

Definition at line 28 of file RayTracing.cc.

References RayTracing::_matCache, ReflectionModel::_pDiffuseBRDF, RayTracing::_pLocalReflection, ReflectionModel::_pSpecularBRDF, RayTracing::_pTexture, ReflectionModel::setDiffuseBRDF(), ReflectionModel::setEmittance(), and ReflectionModel::setSpecularBRDF().

Referenced by RayTracing::_illuminate(), PhotonTracing::_illuminate(), PhotonMapping::_illuminate(), and Caustics::_illuminate().

void _check_point_of_intersection PointEnv &   )  const [protected, inherited]
 

Definition at line 6 of file RayTracing.cc.

Referenced by RayTracing::_illuminate(), PhotonTracing::_illuminate(), PhotonMapping::_illuminate(), and Caustics::_illuminate().

void _direct_illumination PointEnv &  ,
MatVisitor &  ,
unsigned  ,
Color3f & 
[protected, inherited]
 

Definition at line 148 of file RayTracing.cc.

References RayTracing::_apply_texture(), RayTracing::_pLocalReflection, LocalReflection::illuminatePoint(), and LocalReflection::setActBlockingObjCache().

Referenced by RayTracing::_illuminate(), and PhotonMapping::_illuminate().

void _illuminate PointEnv &  ,
unsigned  ,
bool  ,
Color3f & 
[protected, virtual]
 

Reimplemented from RayTracing.

Definition at line 444 of file PhotonMapping.cc.

References PhotonMapping::_cacheIrradiance, RayTracing::_check_material(), RayTracing::_check_point_of_intersection(), PhotonMapping::_diffReflection, RayTracing::_direct_illumination(), PhotonMapping::_illumStage, PhotonMapping::_maxDistToEst, PhotonMapping::_maxError, PhotonMapping::_numPhotonsToEst, PhotonMapping::_pCausticsMap, PhotonMapping::_pGlobalMap, PhotonMapping::_pIrradCache, PhotonMapping::_sample_diffuse(), PhotonMapping::_sample_specular(), PhotonMapping::_sceneDistance, PhotonMapping::_specReflections, PhotonMapping::CAUSTICS, PhotonMapping::DIRECT_ILLUMINATION, PhotonMapping::INDIRECT_ILLUMINATION, and PhotonMapping::SPECULAR_REFLECTION.

double _importance_sampling const Vector3 &  ,
BRDF &  ,
const MatVisitor &  ,
double *  ,
double  ,
Vector3 & 
[protected]
 

Definition at line 126 of file PhotonMapping.cc.

References PhotonMapping::ANTIBIAS_FRACTION, PhotonMapping::PARTITIONING, and PhotonMapping::PARTITIONING_2.

bool _interpolate_irradiance const vector< IrradianceCache::Value * > &  ,
Color3f & 
[protected]
 

Definition at line 60 of file PhotonMapping.cc.

Referenced by PhotonMapping::_sample_diffuse().

double * _power_square const vector< Photon * > &  ,
const Vector3 &  ,
BRDF &  ,
const MatVisitor &  ,
double & 
[protected]
 

Definition at line 86 of file PhotonMapping.cc.

References PhotonMapping::PARTITIONING, and PhotonMapping::PARTITIONING_2.

void _reflection_dir PointEnv &  ,
Vector3 & 
[protected, inherited]
 

Definition at line 188 of file RayTracing.cc.

Referenced by RayTracing::_cast_secondary_rays(), and PhotonMapping::_sample_specular().

RayTracing::RefrDir _refraction_dir PointEnv &  ,
MatVisitor &  ,
bool  ,
Vector3 & 
[protected, inherited]
 

Definition at line 164 of file RayTracing.cc.

References RayTracing::_defaultMediumRefraction, RayTracing::REFR_DIR_REFLECTION, and RayTracing::REFR_DIR_REFRACTION.

Referenced by RayTracing::_cast_secondary_rays(), and PhotonMapping::_sample_specular().

void _sample_diffuse PointEnv &  ,
unsigned  ,
bool  ,
Color3f &  ,
MatVisitor & 
[protected, virtual]
 

Definition at line 179 of file PhotonMapping.cc.

References PhotonMapping::_interpolate_irradiance(), ReflectionModel::_pDiffuseBRDF, and PhotonMapping::_pIrradCache.

Referenced by PhotonMapping::_illuminate().

void _sample_specular PointEnv &  ,
unsigned  ,
bool  ,
Color3f &  ,
MatVisitor & 
[protected, virtual]
 

Definition at line 385 of file PhotonMapping.cc.

References PathTracing::_cast_the_ray(), PhotonMapping::_photonsPerSpecularSurface, ReflectionModel::_pSpecularBRDF, RayTracing::_reflection_dir(), RayTracing::_refraction_dir(), and RayTracing::REFR_DIR_REFLECTION.

Referenced by PhotonMapping::_illuminate().

Color3f * illuminatePoint PointEnv &   )  [virtual]
 

Reimplemented from RayTracing.

Definition at line 624 of file PhotonMapping.cc.

References PhotonMapping::_diffReflection, PhotonMapping::_pCausticsMap, PhotonMapping::_pGlobalMap, PhotonMapping::_pIrradCache, PhotonMapping::_specReflections, and RayTracing::illuminatePoint().

virtual void setDiffuseBRDF DiffuseBRDF *  b  )  [inline, virtual, inherited]
 

Reimplemented from ReflectionModel.

Definition at line 98 of file RayTracing.h.

References ReflectionModel::setDiffuseBRDF().

Referenced by PhotonMapShader::distributeEnergy().

virtual void setEmittance Emittance *  e  )  [inline, virtual, inherited]
 

Reimplemented from ReflectionModel.

Definition at line 110 of file RayTracing.h.

References ReflectionModel::setEmittance().

void setIntersector Intersector *  i  )  [inline, inherited]
 

Definition at line 134 of file RayTracing.h.

void setScene Scene s  )  [virtual]
 

Sets rendered scene. If irradiance caching is required then also discovers and sets the maximal scene distance.

Reimplemented from RayTracing.

Definition at line 634 of file PhotonMapping.cc.

References PhotonMapping::_cacheIrradiance, Scene::root(), and RayTracing::setScene().

virtual void setSpecularBRDF SpecularBRDF *  b  )  [inline, virtual, inherited]
 

Reimplemented from ReflectionModel.

Definition at line 104 of file RayTracing.h.

References ReflectionModel::setSpecularBRDF().

Referenced by PhotonMapShader::distributeEnergy().


Member Data Documentation

Color3f _background [protected, inherited]
 

Definition at line 37 of file RayTracing.h.

Referenced by RayTracing::_cast_secondary_rays(), and PathTracing::_cast_the_ray().

bool _cacheIrradiance [protected]
 

Definition at line 42 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate(), and PhotonMapping::setScene().

float _defaultMediumRefraction [protected, inherited]
 

Definition at line 41 of file RayTracing.h.

Referenced by RayTracing::_refraction_dir().

bool _diffReflection [protected]
 

Definition at line 46 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate(), and PhotonMapping::illuminatePoint().

int _illumStage [protected]
 

Definition at line 39 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate().

bool _incomingLighting [protected]
 

Definition at line 40 of file PhotonMapping.h.

Sgi::hash_map<SceneGraphObject::OID, MatVisitor*> _matCache [protected, inherited]
 

Definition at line 46 of file RayTracing.h.

Referenced by RayTracing::_check_material().

unsigned _maxDepth [protected, inherited]
 

Definition at line 39 of file RayTracing.h.

Referenced by RayTracing::_illuminate(), PhotonTracing::_illuminate(), and Caustics::_illuminate().

float _maxDistToEst [protected]
 

Definition at line 36 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate().

unsigned _maxError [protected]
 

Definition at line 41 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate().

float _minRayWeight [protected, inherited]
 

Definition at line 40 of file RayTracing.h.

Referenced by RayTracing::_cast_secondary_rays(), and PathTracing::_cast_the_ray().

unsigned _numPhotonsToEst [protected]
 

Definition at line 35 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate().

AutoPtr<LocalReflection>* _pAReflection [protected, inherited]
 

Definition at line 36 of file RayTracing.h.

const PhotonMap* _pCausticsMap [protected]
 

Definition at line 49 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate(), and PhotonMapping::illuminatePoint().

DiffuseBRDF* _pDiffuseBRDF [protected, inherited]
 

Definition at line 39 of file ReflectionModel.h.

Referenced by PathTracing::_cast_secondary_rays(), RayTracing::_check_material(), PhotonMapping::_sample_diffuse(), RayTracing::illuminatePoint(), PhotonTracing::illuminatePoint(), LocalReflection::illuminatePoint(), PhongReflection::PhongReflection(), and PhongReflection::~PhongReflection().

Emittance* _pEmittance [protected, inherited]
 

Definition at line 41 of file ReflectionModel.h.

Referenced by LocalReflection::illuminatePoint().

const PhotonMap* _pGlobalMap [protected]
 

Definition at line 48 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate(), and PhotonMapping::illuminatePoint().

unsigned _photonsPerSpecularSurface [protected]
 

Definition at line 34 of file PhotonMapping.h.

Referenced by PhotonMapping::_sample_specular().

unsigned _photonsPerSurface [protected, inherited]
 

Definition at line 24 of file PathTracing.h.

Referenced by PathTracing::_cast_secondary_rays().

Intersector* _pIntersector [protected, inherited]
 

Definition at line 38 of file RayTracing.h.

Referenced by RayTracing::_cast_ray(), RayTracing::illuminatePoint(), and PhotonTracing::illuminatePoint().

IrradianceCache* _pIrradCache [protected]
 

Definition at line 51 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate(), PhotonMapping::_sample_diffuse(), and PhotonMapping::illuminatePoint().

LocalReflection* _pLocalReflection [protected, inherited]
 

Definition at line 42 of file RayTracing.h.

Referenced by RayTracing::_check_material(), RayTracing::_direct_illumination(), and RayTracing::illuminatePoint().

double _preciseIllumDist [protected]
 

Definition at line 38 of file PhotonMapping.h.

unsigned _preciseIllumRefl [protected]
 

Definition at line 37 of file PhotonMapping.h.

Scene* _pScene [protected, inherited]
 

Definition at line 42 of file ReflectionModel.h.

Referenced by RayTracing::_cast_ray(), LocalReflection::_light_visible(), RayTracing::illuminatePoint(), PhotonTracing::illuminatePoint(), LocalReflection::illuminatePoint(), Radiosity::setScene(), and LocalReflection::setScene().

SpecularBRDF* _pSpecularBRDF [protected, inherited]
 

Definition at line 40 of file ReflectionModel.h.

Referenced by PathTracing::_cast_secondary_rays(), RayTracing::_check_material(), PhotonMapping::_sample_specular(), RayTracing::illuminatePoint(), PhotonTracing::illuminatePoint(), LocalReflection::illuminatePoint(), PhongReflection::PhongReflection(), and PhongReflection::~PhongReflection().

Texture* _pTexture [protected, inherited]
 

Definition at line 44 of file RayTracing.h.

Referenced by RayTracing::_apply_texture(), and RayTracing::_check_material().

RayIntExplorer _riExplorer [protected, inherited]
 

Definition at line 43 of file RayTracing.h.

Referenced by RayTracing::_cast_ray().

double _sceneDistance [protected]
 

Definition at line 43 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate().

unsigned _specReflections [protected]
 

Definition at line 45 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate(), and PhotonMapping::illuminatePoint().

const double ANTIBIAS_FRACTION = .001 [static]
 

Definition at line 31 of file PhotonMapping.h.

Referenced by PhotonMapping::_importance_sampling().

const int CAUSTICS = (1<<2) [static]
 

Definition at line 24 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate().

const int DIRECT_ILLUMINATION = (1<<0) [static]
 

Definition at line 22 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate().

const int GLOBAL_ILLUMINATION [static]
 

Initial value:

Definition at line 27 of file PhotonMapping.h.

const int INDIRECT_ILLUMINATION = (1<<3) [static]
 

Definition at line 25 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate().

const unsigned PARTITIONING = 30 [static]
 

Definition at line 29 of file PhotonMapping.h.

Referenced by PhotonMapping::_importance_sampling(), and PhotonMapping::_power_square().

const unsigned PARTITIONING_2 = PARTITIONING * PARTITIONING [static]
 

Definition at line 30 of file PhotonMapping.h.

Referenced by PhotonMapping::_importance_sampling(), and PhotonMapping::_power_square().

const int SPECULAR_REFLECTION = (1<<1) [static]
 

Definition at line 23 of file PhotonMapping.h.

Referenced by PhotonMapping::_illuminate().


The documentation for this class was generated from the following files:
Generated on Tue Nov 21 15:11:43 2006 for gra by  doxygen 1.4.6