20 #if !defined(__MITSUBA_BIDIR_PATHSAMPLER_H_)
21 #define __MITSUBA_BIDIR_PATHSAMPLER_H_
24 #include <boost/function.hpp>
48 typedef boost::function<void (int, int, Float, Path &)>
PathCallback;
103 Sampler *sensorSampler,
Sampler *directSampler,
int maxDepth,
int rrDepth,
104 bool excludeDirectIllum,
bool sampleDirect,
bool lightImage =
true);
145 void samplePaths(
const Point2i &offset, PathCallback &callback);
167 Float generateSeeds(
size_t sampleCount,
size_t seedCount,
168 bool fineGrained,
const Bitmap *importanceMap,
169 std::vector<PathSeed> &seeds);
176 Float computeAverageLuminance(
size_t sampleCount);
185 void reconstructPath(
const PathSeed &seed,
204 bool m_excludeDirectIllum;
207 int m_emitterDepth, m_sensorDepth;
208 Path m_emitterSubpath, m_sensorSubpath;
209 Path m_connectionSubpath, m_fullPath;
230 : sampleIndex(sampleIndex), luminance(luminance), s(s), t(t) { }
247 std::ostringstream oss;
248 oss <<
"PathSeed[" << endl
249 <<
" sampleIndex = " << sampleIndex <<
"," << endl
250 <<
" luminance = " << luminance <<
"," << endl
251 <<
" s = " << s <<
"," << endl
252 <<
" t = " << t << endl
266 m_timeout =
static_cast<const SeedWorkUnit *
>(wu)->m_timeout;
291 m_seed.serialize(stream);
296 return "SeedWorkUnit[]";
311 typedef std::pair<Point2, Spectrum>
Splat;
324 splats.push_back(std::make_pair(samplePos, value));
331 splats[i].second += value;
338 return splats.size();
366 std::string toString()
const;
List storage for the image-space contributions ("splats") of a path sample generated using PathSample...
Definition: pathsampler.h:309
General-purpose bitmap class with read and write support for several common file formats.
Definition: bitmap.h:50
void append(const Point2 &samplePos, const Spectrum &value)
Appends a splat entry to the list.
Definition: pathsampler.h:323
size_t sampleIndex
Index into a rewindable random number stream.
Definition: pathsampler.h:222
int getTimeout() const
Definition: pathsampler.h:277
Float luminance
Combined luminance of all splats in this sample.
Definition: pathsampler.h:316
PathSeed(Stream *stream)
Definition: pathsampler.h:232
Implements a sampling strategy that is able to produce paths using bidirectional path tracing or unid...
Definition: pathsampler.h:39
std::pair< Point2, Spectrum > Splat
Represents a screen-space splat produced by a path sampling technique.
Definition: pathsampler.h:311
Principal scene data structure.
Definition: scene.h:49
SplatList()
Definition: pathsampler.h:320
void setTimeout(int timeout)
Definition: pathsampler.h:281
Base class of all sample generators.
Definition: sampler.h:66
Float readFloat()
Write a floating point number (configured precision) to the stream.
Definition: stream.h:424
Bidirectional path data structure.
Definition: path.h:46
int readInt()
Read a signed int (32 bit) from the stream.
Normal normalize(const Normal &n)
Definition: normal.h:73
void accum(size_t i, const Spectrum &value)
Increases the contribution of an existing splat.
Definition: pathsampler.h:330
int s
Number of steps from the luminaire.
Definition: pathsampler.h:224
void save(Stream *stream) const
Serialize a work unit to a binary data stream.
Definition: pathsampler.h:290
void clear()
Clear the splat list.
Definition: pathsampler.h:342
Float getLuminance() const
Return the luminance in candelas.
Abstract work unit – represents a small amount of information that encodes part of a larger processin...
Definition: sched.h:47
const Point2 & getPosition(size_t i) const
Return the position associated with a splat in the list.
Definition: pathsampler.h:349
Definition: pathsampler.h:262
int t
Number of steps from the eye.
Definition: pathsampler.h:225
void writeFloat(Float value)
Write a floating point number (configured precision) to the stream.
Definition: stream.h:271
Abstract seekable stream class.
Definition: stream.h:58
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
Reference counting helper.
Definition: ref.h:40
void serialize(Stream *stream) const
Definition: pathsampler.h:239
int nSamples
Total number of samples in the splat list.
Definition: pathsampler.h:318
const PathSeed & getSeed() const
Definition: pathsampler.h:269
std::string toString() const
Definition: pathsampler.h:246
std::vector< Splat > splats
A series of splats associated with the current sample.
Definition: pathsampler.h:314
Float luminance
Luminance value of the path (for sanity checks)
Definition: pathsampler.h:223
Bidirectional path tracing.
Definition: pathsampler.h:53
Abstract base class, which describes integrators capable of computing samples of the scene's radiance...
Definition: integrator.h:315
Parent of all Mitsuba classes.
Definition: object.h:38
void load(Stream *stream)
Fill the work unit with content acquired from a binary data stream.
Definition: pathsampler.h:285
MemoryPool & getMemoryPool()
Return the underlying memory pool.
Definition: pathsampler.h:189
ETechnique
Specifies the sampling algorithm that is internally used.
Definition: pathsampler.h:51
PathSeed(size_t sampleIndex, Float luminance, int s=0, int t=0)
Definition: pathsampler.h:229
Discrete spectral power distribution based on a number of wavelength bins over the 360-830 nm range...
Definition: spectrum.h:663
const Spectrum & getValue(size_t i) const
Return the spectral contribution associated with a splat in the list.
Definition: pathsampler.h:352
boost::function< void(int, int, Float, Path &)> PathCallback
Callback type for use with samplePaths()
Definition: pathsampler.h:48
void set(const WorkUnit *wu)
Copy the content of another work unit of the same type.
Definition: pathsampler.h:264
std::string toString() const
Return a string representation.
Definition: pathsampler.h:295
void setSeed(const PathSeed &seed)
Definition: pathsampler.h:273
void writeSize(size_t value)
Write a size value to the stream.
Definition: stream.h:214
PathSeed()
Definition: pathsampler.h:227
size_t readSize()
Read a size value from the stream.
Definition: stream.h:367
void writeInt(int value)
Write a signed int (32 bit) to the stream.
Stores information required to re-create a seed path (e.g. for MLT)
Definition: pathsampler.h:221
size_t size() const
Returns the number of contributions.
Definition: pathsampler.h:337