Implementation of the photon map data structure. More...
#include <mitsuba/render/photonmap.h>
Inheritance diagram for mitsuba::PhotonMap:Public Types | |
| typedef PointKDTree< Photon > | PhotonTree |
| typedef PhotonTree::IndexType | IndexType |
| typedef PhotonTree::SearchResult | SearchResult |
Public Member Functions | |
| PhotonMap (size_t photonCount=0) | |
| Create an empty photon map and reserve memory for a specified number of photons. More... | |
| PhotonMap (Stream *stream, InstanceManager *manager) | |
| Unserialize a photon map from a binary data stream. More... | |
| bool | tryAppend (const Photon &photon) |
| Try to append a photon to the photon map. More... | |
| void | setScaleFactor (Float value) |
| Scale all photon power values contained in this photon map. More... | |
| Float | getScaleFactor () const |
| Return the power scale factor of this photon map. More... | |
| void | build (bool recomputeAABB=false) |
| Build a photon map over the supplied photons. More... | |
| size_t | getDepth () const |
| Return the depth of the constructed KD-tree. More... | |
| bool | isFull () const |
| Determine if the photon map is completely filled. More... | |
| void | serialize (Stream *stream, InstanceManager *manager) const |
| Serialize a photon map to a binary data stream. More... | |
| void | dumpOBJ (const std::string &filename) |
| Dump the photons to an OBJ file to analyze their spatial distribution. More... | |
| std::string | toString () const |
| Return a string representation. More... | |
| virtual const Class * | getClass () const |
| Retrieve this object's class. More... | |
\c stl::vector-like interface | |
| void | clear () |
| Clear the kd-tree array. More... | |
| void | resize (size_t size) |
| Resize the kd-tree array. More... | |
| void | reserve (size_t size) |
| Reserve a certain amount of memory for the kd-tree array. More... | |
| size_t | size () const |
| Return the size of the kd-tree. More... | |
| size_t | capacity () const |
| Return the capacity of the kd-tree. More... | |
| void | push_back (const Photon &photon) |
| Append a kd-tree photon to the photon array. More... | |
| Photon & | operator[] (size_t idx) |
| Return one of the photons by index. More... | |
| const Photon & | operator[] (size_t idx) const |
| Return one of the photons by index (const version) More... | |
\c Photon map query functions | |
| Spectrum | estimateIrradiance (const Point &p, const Normal &n, Float searchRadius, int maxDepth, size_t maxPhotons) const |
| Estimate the irradiance at a given surface position. More... | |
| Spectrum | estimateRadiance (const Intersection &its, Float searchRadius, size_t maxPhotons) const |
| Estimate the radiance received from an intersected surface. More... | |
| size_t | estimateRadianceRaw (const Intersection &its, Float searchRadius, Spectrum &result, int maxDepth) const |
| Compute scattered contributions from all photons within the specified radius. More... | |
| size_t | nnSearch (const Point &p, Float &sqrSearchRadius, size_t k, SearchResult *results) const |
| Perform a nearest-neighbor query, see PointKDTree for details. More... | |
| size_t | nnSearch (const Point &p, size_t k, SearchResult *results) const |
| Perform a nearest-neighbor query, see PointKDTree for details. More... | |
Public Member Functions inherited from mitsuba::SerializableObject | |
| SerializableObject (Stream *stream, InstanceManager *manager) | |
| Unserialize a serializable object. 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... | |
Static Public Attributes | |
| static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::SerializableObject | |
| 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 | ~PhotonMap () |
| Virtual destructor. More... | |
Protected Member Functions inherited from mitsuba::SerializableObject | |
| SerializableObject () | |
| Construct a serializable object. More... | |
| virtual | ~SerializableObject () |
| Virtual deconstructor. More... | |
Protected Member Functions inherited from Object | |
| virtual | ~Object () |
| Virtual private deconstructor. (Will only be called by ref) More... | |
Protected Attributes | |
| PhotonTree | m_kdtree |
| Float | m_scale |
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... | |
Implementation of the photon map data structure.
Based on Henrik Wann Jensen's book "Realistic Image Synthesis Using Photon Mapping".
| typedef PhotonTree::SearchResult mitsuba::PhotonMap::SearchResult |
| mitsuba::PhotonMap::PhotonMap | ( | size_t | photonCount = 0 | ) |
Create an empty photon map and reserve memory for a specified number of photons.
| mitsuba::PhotonMap::PhotonMap | ( | Stream * | stream, |
| InstanceManager * | manager | ||
| ) |
Unserialize a photon map from a binary data stream.
|
protectedvirtual |
Virtual destructor.
|
inline |
Build a photon map over the supplied photons.
This has to be done once after all photons have been stored, but prior to executing any queries.
|
inline |
Return the capacity of the kd-tree.
|
inline |
Clear the kd-tree array.
| void mitsuba::PhotonMap::dumpOBJ | ( | const std::string & | filename | ) |
Dump the photons to an OBJ file to analyze their spatial distribution.
| Spectrum mitsuba::PhotonMap::estimateIrradiance | ( | const Point & | p, |
| const Normal & | n, | ||
| Float | searchRadius, | ||
| int | maxDepth, | ||
| size_t | maxPhotons | ||
| ) | const |
Estimate the irradiance at a given surface position.
Uses a Simpson filter to smooth the data.
| p | The surface position for the estimate |
| n | Normal vector of the surface in question |
| searchRadius | Size of the spherical photon search region |
| maxDepth | Ignore photons that have undergone more than maxDepth interactions |
| maxPhotons | How many photon should (at most) be used in the estimate? |
| Spectrum mitsuba::PhotonMap::estimateRadiance | ( | const Intersection & | its, |
| Float | searchRadius, | ||
| size_t | maxPhotons | ||
| ) | const |
Estimate the radiance received from an intersected surface.
Uses a Simpson filter to smooth the data.
| p | The surface position for the estimate |
| n | Normal vector of the surface in question |
| searchRadius | Size of the spherical photon search region |
| maxPhotons | How many photon should (at most) be used in the estimate? |
| size_t mitsuba::PhotonMap::estimateRadianceRaw | ( | const Intersection & | its, |
| Float | searchRadius, | ||
| Spectrum & | result, | ||
| int | maxDepth | ||
| ) | const |
Compute scattered contributions from all photons within the specified radius.
Does no weighting/filtering/dynamic search radius reduction and simply sums over all photons. Only considers photons with a depth value less than or equal to the maxDepth parameter. This function is meant to be used with progressive photon mapping.
|
virtual |
Retrieve this object's class.
Reimplemented from mitsuba::SerializableObject.
|
inline |
Return the depth of the constructed KD-tree.
|
inline |
Return the power scale factor of this photon map.
|
inline |
Determine if the photon map is completely filled.
|
inline |
Perform a nearest-neighbor query, see PointKDTree for details.
|
inline |
Perform a nearest-neighbor query, see PointKDTree for details.
|
inline |
Return one of the photons by index.
|
inline |
Return one of the photons by index (const version)
|
inline |
Append a kd-tree photon to the photon array.
|
inline |
Reserve a certain amount of memory for the kd-tree array.
|
inline |
Resize the kd-tree array.
|
virtual |
Serialize a photon map to a binary data stream.
Implements mitsuba::SerializableObject.
|
inline |
Scale all photon power values contained in this photon map.
|
inline |
Return the size of the kd-tree.
|
virtual |
Return a string representation.
Reimplemented from Object.
Try to append a photon to the photon map.
false If the photon map is full
|
protected |
|
protected |
|
static |