Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::PathSampler Class Reference

Implements a sampling strategy that is able to produce paths using bidirectional path tracing or unidirectional volumetric path tracing. More...

#include <mitsuba/bidir/pathsampler.h>

+ Inheritance diagram for mitsuba::PathSampler:

Public Types

enum  ETechnique { EBidirectional, EUnidirectional }
 Specifies the sampling algorithm that is internally used. More...
 
typedef boost::function< void(int,
int, Float, Path &)> 
PathCallback
 Callback type for use with samplePaths() More...
 

Public Member Functions

 PathSampler (ETechnique technique, const Scene *scene, Sampler *emitterSampler, Sampler *sensorSampler, Sampler *directSampler, int maxDepth, int rrDepth, bool excludeDirectIllum, bool sampleDirect, bool lightImage=true)
 
void sampleSplats (const Point2i &offset, SplatList &list)
 Generate a sample using the configured sampling strategy. More...
 
void samplePaths (const Point2i &offset, PathCallback &callback)
 Sample a series of paths and invoke the specified callback function for each one. More...
 
Float generateSeeds (size_t sampleCount, size_t seedCount, bool fineGrained, const Bitmap *importanceMap, std::vector< PathSeed > &seeds)
 Generates a sequence of seeds that are suitable for starting a MLT Markov Chain. More...
 
Float computeAverageLuminance (size_t sampleCount)
 Compute the average luminance over the image plane. More...
 
void reconstructPath (const PathSeed &seed, const Bitmap *importanceMap, Path &result)
 Reconstruct a path from a PathSeed record. More...
 
MemoryPoolgetMemoryPool ()
 Return the underlying memory pool. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const
 Return a human-readable string representation of the object's contents. More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~PathSampler ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

ETechnique m_technique
 
ref< const Scenem_scene
 
ref< SamplingIntegratorm_integrator
 
ref< Samplerm_emitterSampler
 
ref< Samplerm_sensorSampler
 
ref< Samplerm_directSampler
 
int m_maxDepth
 
int m_rrDepth
 
bool m_excludeDirectIllum
 
bool m_sampleDirect
 
bool m_lightImage
 
int m_emitterDepth
 
int m_sensorDepth
 
Path m_emitterSubpath
 
Path m_sensorSubpath
 
Path m_connectionSubpath
 
Path m_fullPath
 
MemoryPool m_pool
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Detailed Description

Implements a sampling strategy that is able to produce paths using bidirectional path tracing or unidirectional volumetric path tracing.

This versatile class does the heavy lifting under the hood of Mitsuba's PSSMLT implementation. It is also used to provide the Veach-MLT implementation with a luminance estimate and seed paths.

Author
Wenzel Jakob

Member Typedef Documentation

typedef boost::function<void (int, int, Float, Path &)> mitsuba::PathSampler::PathCallback

Callback type for use with samplePaths()

The arguments are (s, t, weight, path) where s denotes the number of steps from the emitter, is the number of steps from the sensor, and weight contains the importance weight associated with the sample.

Member Enumeration Documentation

Specifies the sampling algorithm that is internally used.

Enumerator
EBidirectional 

Bidirectional path tracing.

EUnidirectional 

Unidirectional path tracing (via the 'volpath' plugin)

Constructor & Destructor Documentation

mitsuba::PathSampler::PathSampler ( ETechnique  technique,
const Scene scene,
Sampler emitterSampler,
Sampler sensorSampler,
Sampler directSampler,
int  maxDepth,
int  rrDepth,
bool  excludeDirectIllum,
bool  sampleDirect,
bool  lightImage = true 
)

Construct a new path sampler

Parameters
techniqueWhat path generation technique should be used (unidirectional or bidirectional path tracing?)
sceneA pointer to the underlying scene
emitterSamplerSample generator that should be used for the random walk from the emitter direction
sensorSamplerSample generator that should be used for the random walk from the sensor direction
directSamplerSample generator that should be used for direct sampling strategies (or NULL, when sampleDirect=false)
maxDepthMaximum path depth to be visualized (-1==infinite)
rrDepthDepth to begin using russian roulette
excludeDirectIllumIf set to true, the direct illumination component will be ignored. Note that this parameter is unrelated to the next one (sampleDirect) although they are named similarly.
sampleDirectWhen this parameter is set to true, specialized direct sampling strategies are used for s=1 and t=1 paths.
lightImageDenotes whether or not rendering strategies that require a 'light image' (specifically, those with t==0 or t==1) are included in the rendering process.
virtual mitsuba::PathSampler::~PathSampler ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

Float mitsuba::PathSampler::computeAverageLuminance ( size_t  sampleCount)

Compute the average luminance over the image plane.

Parameters
sampleCountThe number of luminance samples that will be taken
Float mitsuba::PathSampler::generateSeeds ( size_t  sampleCount,
size_t  seedCount,
bool  fineGrained,
const Bitmap importanceMap,
std::vector< PathSeed > &  seeds 
)

Generates a sequence of seeds that are suitable for starting a MLT Markov Chain.

This function additionally computes the average luminance over the image plane.

Parameters
sampleCountThe number of luminance samples that will be taken
seedCountThe desired number of MLT seeds (must be > sampleCount)
fineGrainedThis parameter only matters when the technique is set to EBidirectional. It specifies whether to generate PathSeed records at the granularity of entire sensor/emitter subpaths or at the granularity of their constituent sampling strategies.
seedsA vector of resulting MLT seeds
Returns
The average luminance over the image plane
virtual const Class* mitsuba::PathSampler::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

MemoryPool& mitsuba::PathSampler::getMemoryPool ( )
inline

Return the underlying memory pool.

void mitsuba::PathSampler::reconstructPath ( const PathSeed seed,
const Bitmap importanceMap,
Path result 
)

Reconstruct a path from a PathSeed record.

Given a PathSeed data structure, this function rewinds the random number stream of the underlying ReplayableSampler to the indicated position and recreates the associated path.

void mitsuba::PathSampler::samplePaths ( const Point2i offset,
PathCallback callback 
)

Sample a series of paths and invoke the specified callback function for each one.

This function is similar to sampleSplats(), but instead of returning only the contribution of the samples paths in the form of screen-space "splats", it returns the actual paths by invoking a specified callback function multiple times.

This function is currently only implemented for the bidirectional sampling strategy – i.e. it cannot be used with the unidirectional path tracer.

Parameters
offsetSpecifies the desired integer pixel position of the sample. The special value Point2i(-1) results in uniform sampling in screen space.
pathCallbackA callback function that will be invoked once for each path generated by the BDPT sampling strategy. The first argument specifies the path importance weight.
void mitsuba::PathSampler::sampleSplats ( const Point2i offset,
SplatList list 
)

Generate a sample using the configured sampling strategy.

The result is stored as a series of screen-space splats (pixel position and spectral value pairs) within the parameter list. These can be used to implement algorithms like Bidirectional Path Tracing or Primary Sample Space MLT.

Parameters
offsetSpecifies the desired integer pixel position of the sample. The special value Point2i(-1) results in uniform sampling in screen space.
listOutput parameter that will receive a list of splats

Member Data Documentation

Path mitsuba::PathSampler::m_connectionSubpath
protected
ref<Sampler> mitsuba::PathSampler::m_directSampler
protected
int mitsuba::PathSampler::m_emitterDepth
protected
ref<Sampler> mitsuba::PathSampler::m_emitterSampler
protected
Path mitsuba::PathSampler::m_emitterSubpath
protected
bool mitsuba::PathSampler::m_excludeDirectIllum
protected
Path mitsuba::PathSampler::m_fullPath
protected
ref<SamplingIntegrator> mitsuba::PathSampler::m_integrator
protected
bool mitsuba::PathSampler::m_lightImage
protected
int mitsuba::PathSampler::m_maxDepth
protected
MemoryPool mitsuba::PathSampler::m_pool
protected
int mitsuba::PathSampler::m_rrDepth
protected
bool mitsuba::PathSampler::m_sampleDirect
protected
ref<const Scene> mitsuba::PathSampler::m_scene
protected
int mitsuba::PathSampler::m_sensorDepth
protected
ref<Sampler> mitsuba::PathSampler::m_sensorSampler
protected
Path mitsuba::PathSampler::m_sensorSubpath
protected
ETechnique mitsuba::PathSampler::m_technique
protected
Class* mitsuba::PathSampler::m_theClass
static

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