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>
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... | |
MemoryPool & | getMemoryPool () |
Return the underlying memory pool. More... | |
virtual const Class * | getClass () 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 Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_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 Scene > | m_scene |
ref< SamplingIntegrator > | m_integrator |
ref< Sampler > | m_emitterSampler |
ref< Sampler > | m_sensorSampler |
ref< Sampler > | m_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... | |
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.
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.
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
technique | What path generation technique should be used (unidirectional or bidirectional path tracing?) |
scene | A pointer to the underlying scene |
emitterSampler | Sample generator that should be used for the random walk from the emitter direction |
sensorSampler | Sample generator that should be used for the random walk from the sensor direction |
directSampler | Sample generator that should be used for direct sampling strategies (or NULL , when sampleDirect= |
maxDepth | Maximum path depth to be visualized (-1==infinite) |
rrDepth | Depth to begin using russian roulette |
excludeDirectIllum | If 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. |
sampleDirect | When this parameter is set to true, specialized direct sampling strategies are used for s=1 and t=1 paths. |
lightImage | Denotes whether or not rendering strategies that require a 'light image' (specifically, those with t==0 or t==1 ) are included in the rendering process. |
|
protectedvirtual |
Virtual destructor.
Float mitsuba::PathSampler::computeAverageLuminance | ( | size_t | sampleCount | ) |
Compute the average luminance over the image plane.
sampleCount | The 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.
sampleCount | The number of luminance samples that will be taken |
seedCount | The desired number of MLT seeds (must be > sampleCount ) |
fineGrained | This 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. |
seeds | A vector of resulting MLT seeds |
|
virtual |
Retrieve this object's class.
Reimplemented from Object.
|
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.
offset | Specifies the desired integer pixel position of the sample. The special value Point2i(-1) results in uniform sampling in screen space. |
pathCallback | A callback function that will be invoked once for each path generated by the BDPT sampling strategy. The first argument specifies the path importance weight. |
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.
offset | Specifies the desired integer pixel position of the sample. The special value Point2i(-1) results in uniform sampling in screen space. |
list | Output parameter that will receive a list of splats |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |