Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mut_manifold.h
Go to the documentation of this file.
1 /*
2  This file is part of Mitsuba, a physically based rendering system.
3 
4  Copyright (c) 2007-2014 by Wenzel Jakob and others.
5 
6  Mitsuba is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Mitsuba is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 #if !defined(__MITSUBA_BIDIR_MUT_MANIFOLD_H_)
21 #define __MITSUBA_BIDIR_MUT_MANIFOLD_H_
22 
23 #include <mitsuba/bidir/mutator.h>
24 
26 
27 #define MTS_MANIFOLD_QUANTILE_SURFACE 0.9f
28 #define MTS_MANIFOLD_QUANTILE_MEDIUM 0.5f
29 
30 /**
31  * \brief Specular manifold perturbation strategy
32  *
33  * \author Wenzel Jakob
34  * \ingroup libbidir
35  */
37 public:
38  /**
39  * \brief Construct a new specular manifold perturbation strategy
40  *
41  * \param scene
42  * A pointer to the underlying scene
43  *
44  * \param sampler
45  * A sample generator
46  *
47  * \param pool
48  * A memory pool used to allocate new path vertices and edges
49  */
50  ManifoldPerturbation(const Scene *scene, Sampler *sampler,
51  MemoryPool &pool,
52  Float probFactor,
53  bool enableOffsetManifolds,
54  bool enableSpecularMedia,
55  Float avgAngleChangeSurface = 0,
56  Float avgAngleChangeMedium = 0);
57 
58  // =============================================================
59  //! @{ \name Implementation of the Mutator interface
60 
61  EMutationType getType() const;
62  Float suitability(const Path &path) const;
63  bool sampleMutation(Path &source, Path &proposal,
64  MutationRecord &muRec, const MutationRecord& sourceMuRec);
65  Float Q(const Path &source, const Path &proposal,
66  const MutationRecord &muRec) const;
67  void accept(const MutationRecord &muRec);
68 
69  //! @}
70  // =============================================================
71 
73 protected:
74  /// Virtual destructor
75  virtual ~ManifoldPerturbation();
76 
77  /// Helper function for choosing mutation strategies
78  bool sampleMutationRecord(const Path &source,
79  int &a, int &b, int &c, int &step);
80 
81  Float nonspecularProbSurface(Float alpha) const;
82  Float nonspecularProbMedium(Float g) const;
83 
84  Float nonspecularProb(const PathVertex *vertex) const;
85  inline Float specularProb(const PathVertex *vertex) const {
86  return 1 - nonspecularProb(vertex);
87  }
88 
89  int getSpecularChainEnd(const Path &path, int pos, int step);
90 protected:
95  Float m_probFactor, m_probFactor2;
103 };
104 
106 
107 #endif /*__MITSUBA_BIDIR_MUT_MANIFOLD_H_ */
static Float m_thetaDiffSurface
Definition: mut_manifold.h:98
bool m_enableSpecularMedia
Definition: mut_manifold.h:97
#define MTS_EXPORT_BIDIR
Definition: platform.h:119
Medium-aware mutator base class.
Definition: mutator.h:143
Bidirectional path vertex data structure.
Definition: vertex.h:48
Stores supplemental information about an executed mutation strategy.
Definition: mutator.h:115
virtual void accept(const MutationRecord &muRec)=0
Record an accepted mutation.
ref< SpecularManifold > m_manifold
Definition: mut_manifold.h:93
Specular manifold perturbation strategy.
Definition: mut_manifold.h:36
bool m_enableOffsetManifolds
Definition: mut_manifold.h:96
Principal scene data structure.
Definition: scene.h:49
MemoryPool & m_pool
Definition: mut_manifold.h:94
Float m_probFactor2
Definition: mut_manifold.h:95
Base class of all sample generators.
Definition: sampler.h:66
Bidirectional path data structure.
Definition: path.h:46
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
static int m_thetaDiffSurfaceSamples
Definition: mut_manifold.h:100
ref< const Scene > m_scene
Definition: mut_manifold.h:91
static int m_thetaDiffMediumSamples
Definition: mut_manifold.h:101
static Mutex * m_thetaDiffMutex
Definition: mut_manifold.h:102
virtual Float Q(const Path &source, const Path &proposal, const MutationRecord &muRec) const =0
For a pair of paths, this function computes the inverse transition probability (matching the Q term i...
static Float m_thetaDiffMedium
Definition: mut_manifold.h:99
virtual bool sampleMutation(Path &source, Path &proposal, MutationRecord &muRec, const MutationRecord &sourceMuRec)=0
Given a path, this function produces a new proposal according to the internally implemented mutation ...
virtual EMutationType getType() const =0
What kind of mutations does this mutator perform?
EMutationType
Specifies the type of mutation implemented by the mutator.
Definition: mutator.h:36
#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
virtual Float suitability(const Path &path) const =0
Determine the general &quot;suitability&quot; of this mutator for a given kind of path.
ref< Sampler > m_sampler
Definition: mut_manifold.h:92
Definition: mempool.h:29
#define MTS_NAMESPACE_END
Definition: platform.h:138
Thin wrapper around the recursive boost thread lock.
Definition: lock.h:34