Bidirectional path vertex data structure. More...
#include <mitsuba/bidir/vertex.h>
Public Member Functions | |
Sampling-related functions | |
void | makeEndpoint (const Scene *scene, Float time, ETransportMode mode) |
Generate a path endpoint that can be used to start a random walk. More... | |
bool | sampleNext (const Scene *scene, Sampler *sampler, const PathVertex *pred, const PathEdge *predEdge, PathEdge *succEdge, PathVertex *succ, ETransportMode mode, bool russianRoulette=false, Spectrum *throughput=NULL) |
Sample the next vertex in a random walk using the default sampling technique implemented by the current vertex. More... | |
Spectrum | sampleDirect (const Scene *scene, Sampler *sampler, PathVertex *endpoint, PathEdge *edge, PathVertex *sample, ETransportMode mode) const |
Direct sampling: given the current vertex as a reference sample an emitter (or sensor) position that has a nonzero emission (or response) towards it. More... | |
int | sampleSensor (const Scene *scene, Sampler *sampler, const Point2i &pixelPosition, PathEdge *e0, PathVertex *v1, PathEdge *e1, PathVertex *v2) |
Sample the first vertices on a sensor subpath such that they contribute to a specified pixel in the output image. More... | |
bool | perturbDirection (const Scene *scene, const PathVertex *pred, const PathEdge *predEdge, PathEdge *succEdge, PathVertex *succ, const Vector &d, Float dist, EVertexType desiredType, ETransportMode mode) |
Create a perturbed successor vertex and edge. More... | |
bool | perturbPosition (const Scene *scene, Sampler *sampler, Float stddev) |
Generate a path endpoint that can be used to start a random walk. More... | |
Float | perturbPositionPdf (const PathVertex *target, Float stddev) const |
Generate a path endpoint that can be used to start a random walk. More... | |
bool | propagatePerturbation (const Scene *scene, const PathVertex *pred, const PathEdge *predEdge, PathEdge *succEdge, PathVertex *succ, unsigned int componentType, Float dist, EVertexType desiredType, ETransportMode mode) |
Propagate a perturbation through an ideally specular interaction. More... | |
Query functions | |
Spectrum | eval (const Scene *scene, const PathVertex *pred, const PathVertex *succ, ETransportMode mode, EMeasure measure=EArea) const |
Evaluate the terms of the measurement contribution function that are associated with this vertex. More... | |
Float | evalPdf (const Scene *scene, const PathVertex *pred, const PathVertex *succ, ETransportMode mode, EMeasure measure=EArea) const |
Compute the density of a successor node. More... | |
Float | evalPdfDirect (const Scene *scene, const PathVertex *sample, ETransportMode mode, EMeasure measure=EArea) const |
Compute the area density of a provided emitter or sensor sample with respect the direct sampling technique implemented in sampleDirect(). More... | |
const Medium * | getTargetMedium (const PathEdge *predEdge, const PathVertex *succ) const |
Determine the medium that fills the space between the current vertex and a specified successor. More... | |
const Medium * | getTargetMedium (const PathEdge *predEdge, const Vector &d) const |
Determine the medium that fills the space in direction d . More... | |
Accessors | |
EVertexType | getType () const |
Return the type associated with this vertex. More... | |
Point | getPosition () const |
Return the position associated with this vertex. More... | |
bool | isOnSurface () const |
Check if the vertex lies on a surface. More... | |
bool | isNullInteraction () const |
Returns whether or not this vertex describes a "null" scattering interaction. More... | |
bool | isDiffuseInteraction () const |
Returns whether or not this vertex describes a diffuse surface scattering interaction. More... | |
bool | isAbsorbing () const |
Returns whether or not this vertex describes a 100% absorbing surface. More... | |
unsigned int | getComponentType () const |
Return the component type associated with this vertex. More... | |
Normal | getGeometricNormal () const |
Return the geometric surface normal associated with this vertex. More... | |
Normal | getShadingNormal () const |
Return the shading surface normal associated with this vertex. More... | |
Float | getTime () const |
Return the time value associated with this node. More... | |
bool | isSupernode () const |
Is this vertex a supernode? More... | |
bool | isSensorSupernode () const |
Is this vertex a sensor super-node? More... | |
bool | isEmitterSupernode () const |
Is this vertex a emitter super-node? More... | |
bool | isEmitterSample () const |
Is this vertex an emitter sample? More... | |
bool | isSensorSample () const |
Is this vertex a lens sample? More... | |
bool | isSurfaceInteraction () const |
Is this vertex a surface interaction? More... | |
bool | isMediumInteraction () const |
Is this vertex a medium interaction? More... | |
EndpointRecord & | getEndpointRecord () |
Return the endpoint record associated with this node. More... | |
const EndpointRecord & | getEndpointRecord () const |
Return the endpoint record associated with this node (const) More... | |
PositionSamplingRecord & | getPositionSamplingRecord () |
Return the position sampling record associated with this node. More... | |
const PositionSamplingRecord & | getPositionSamplingRecord () const |
Return the position sampling record associated with this node (const) More... | |
Intersection & | getIntersection () |
Return the intersection record associated with this node. More... | |
const Intersection & | getIntersection () const |
Return the intersection record associated with this node (const) More... | |
MediumSamplingRecord & | getMediumSamplingRecord () |
Return the medium sampling record associated with this node. More... | |
const MediumSamplingRecord & | getMediumSamplingRecord () const |
Return the medium sampling record associated with this node. More... | |
const Point2 & | getSamplePosition () const |
Return the fractional pixel position associated with a sensor sample. More... | |
const AbstractEmitter * | getAbstractEmitter () const |
Return the abstract emitter associated with a sensor/emitter sample. More... | |
bool | isDegenerate () const |
Returns whether or not this vertex is degenerate, i.e. its distribution has measure zero. More... | |
bool | isConnectable () const |
Returns whether or not this vertex can be deterministically connected to other vertices. More... | |
bool | updateSamplePosition (const PathVertex *succ) |
Special routine for sensor sample vertices: given a successor succ , update the fractional pixel position stored in the vertex. More... | |
bool | getSamplePosition (const PathVertex *succ, Point2 &result) const |
Special routine for sensor sample vertices: given a successor succ , return its associated fractional pixel position. More... | |
Enumerations and Fields | |
enum | { EDataSize } |
Denotes the size of the auxiliary data section associated with each node. More... | |
enum | EVertexType { EInvalid = 0, ESensorSupernode = 1, EEmitterSupernode = 2, ESensorSample = 4, EEmitterSample = 8, ESurfaceInteraction = 16, EMediumInteraction = 32, ESupernode = ESensorSupernode | EEmitterSupernode, ENormal } |
What kind of vertex is this (e.g. medium, surface, emitter)? More... | |
EVertexType | type: 7 |
Specifies one of several possible path vertex types. More... | |
bool | degenerate: 1 |
Denotes whether this vertex only supports sampling from degenerate distributions. More... | |
EMeasure | measure: 8 |
Denotes the measure associated with the probability densities stored in pdf. More... | |
uint16_t | componentType |
When the current vertex supports sampling from several components (this currently only applies to BSDF lobes), this attribute records the type sampled component. More... | |
Spectrum | weight [ETransportModes] |
Measurement contribution weight. More... | |
Float | pdf [ETransportModes] |
Area density of the two adjacent vertices. More... | |
Float | rrWeight |
Termination weight due to russian roulette (used by BDPT) More... | |
uint8_t | data [EDataSize] |
Auxilary node-depependent data associated with each vertex. More... | |
Miscellaneous | |
bool | cast (const Scene *scene, EVertexType desired) |
Cast this vertex into an equivalent from having a different type. More... | |
bool | verify (const Scene *scene, const PathVertex *adjL, const PathVertex *adjE, ETransportMode mode, std::ostream &os) const |
Verify the cached values stored in this path vertex for consistency. More... | |
bool | update (const Scene *scene, const PathVertex *pred, const PathVertex *succ, ETransportMode mode, EMeasure measure=EArea) |
Given the specified predecessor and successor, update the cached values stored in this vertex. More... | |
PathVertex * | clone (MemoryPool &pool) const |
Create a deep copy of this vertex. More... | |
std::string | toString () const |
Return a string representation of the information stored in this vertex. More... | |
bool | operator== (const PathVertex &vertex) const |
Compare this vertex against another vertex. More... | |
bool | operator!= (const PathVertex &vertex) const |
Compare this vertex against another vertex. More... | |
static bool | connect (const Scene *scene, const PathVertex *pred, const PathEdge *predEdge, PathVertex *vs, PathEdge *edge, PathVertex *vt, const PathEdge *succEdge, const PathVertex *succ) |
Create a connection between two disconnected subpaths. More... | |
static bool | connect (const Scene *scene, const PathVertex *pred, const PathEdge *predEdge, PathVertex *vs, PathEdge *edge, PathVertex *vt, const PathEdge *succEdge, const PathVertex *succ, EMeasure vsMeasure, EMeasure vtMeasure) |
Like the above, but can be used to connect delta endpoints. More... | |
Bidirectional path vertex data structure.
The path vertex data structure represents a basic interaction within the path-space light transport framework. It abstracts away the specifics of the underlying interaction, which simplifies the implementation of bidirectional rendering techniques such as Bidirectional Path Tracing or Veach-style Metropolis Light Transport.
This data structure can describe a several different types of interactions, including surface and medium scattering events, as well as emission events by a light source or a sensor (in the bidirectional framework, the response of a sensor is treated as an emitted quantity)
A path vertex only describes what happens at the location of a scattering or emission event – what happens in between such interactions is captured in a separate data structure named PathEdge.
anonymous enum |
What kind of vertex is this (e.g. medium, surface, emitter)?
The two special 'supernode' types are used as path endpoints, which greatly simplifies the control flow of various functions in this data structure and the MLT/BDPT implementations.
bool mitsuba::PathVertex::cast | ( | const Scene * | scene, |
EVertexType | desired | ||
) |
Cast this vertex into an equivalent from having a different type.
Sometimes it is necessary to cast a vertex into a different type. An example when this occurs is when a surface interaction vertex lies on the surface of an emitter or a sensor. In such a situation, it may be useful to retroactively turn it into an emitter or sensor sample vertex located at the same position. This function allows to do precisely that.
scene | A pointer to the underlying scene |
desired | Desired type after the cast |
true
on success. When returning false
, the function did not make any changes. PathVertex* mitsuba::PathVertex::clone | ( | MemoryPool & | pool | ) | const |
Create a deep copy of this vertex.
|
static |
Create a connection between two disconnected subpaths.
This function can be used to connect two seperately created emitter and sensor subpaths so that they can be merged into a Path data structure. The function checks that the vertices vs
and vt
are mutually visible, and that there is a nonzero throughput between them. If that is the case, it updates the cached values stored in vs
, edge
, and vt
.
The expected order of the parameters in path-space is
(pred) -> predEdge -> (vs) -> edge -> (vt) -> succEdge -> (succ)
where entries in parentheses denote vertices, pred
is the closer to the light source, and succ
is the closer to the sensor.
scene | Pointer to the underlying scene |
pred | Pointer to the predecessor vertex of vs (towards the emitter) |
predEdge | Pointer to an edge between pred and vs . |
vs | Last vertex of the emitter subpath to be connected. The cached values of this vertex will be updated should the connection attempt succeed. |
edge | Pointer to an unused edge data structure, which will be annotated with information about the medium-related transport between vs and vt . |
vt | Last vertex of the sensor subpath to be connected. The cached values of this vertex will be updated should the connection attempt succeed. |
succEdge | Pointer to an edge between vt and succ . |
succ | Pointer to the successor vertex of vt (towards the sensor) |
true
upon success, false
when there is no throughput or an inconsistency has been detected.
|
static |
Like the above, but can be used to connect delta endpoints.
Spectrum mitsuba::PathVertex::eval | ( | const Scene * | scene, |
const PathVertex * | pred, | ||
const PathVertex * | succ, | ||
ETransportMode | mode, | ||
EMeasure | measure = EArea |
||
) | const |
Evaluate the terms of the measurement contribution function that are associated with this vertex.
Compute a single term of the contribution weighting function associated with the current node given a predecessor and successor node.
Note: this function only accounts for the factor associated with this specific vertex – to account for an adjacent edge, refer to PathEdge::eval.
scene | Pointer to the underlying scene |
pred | Pointer to the preceding vertex (if any) and NULL otherwise |
succ | Pointer to the successor vertex (if any) and NULL otherwise |
mode | Specifies whether radiance or importance is being transported |
measure | Specifies the measure of the queried component. This is necessary to handle mixture scattering functions, whose components are defined on spaces with different measures. |
Float mitsuba::PathVertex::evalPdf | ( | const Scene * | scene, |
const PathVertex * | pred, | ||
const PathVertex * | succ, | ||
ETransportMode | mode, | ||
EMeasure | measure = EArea |
||
) | const |
Compute the density of a successor node.
This function computes the hypothetical scattering-related sampling density of a given successor node when using the sampling technique implemented by sampleNext(). Since this technique conditions on a predecessor vertex, it must also be provided here. The desired measure (e.g. area/solid angle/discrete) can be provided as an extra parameter.
Note: this function only computes probability associated with the vertices – to account for edges, refer to PathEdge::evalPdf.
scene | Pointer to the underlying scene |
pred | Pointer to the preceding vertex (if any) and NULL otherwise |
succ | Pointer to the successor vertex (if any) and NULL otherwise |
mode | Specifies whether radiance or importance is being transported |
measure | Specifies the measure of the queried component. This is necessary to handle mixture scattering functions, whose components are defined on spaces with different measures. |
Float mitsuba::PathVertex::evalPdfDirect | ( | const Scene * | scene, |
const PathVertex * | sample, | ||
ETransportMode | mode, | ||
EMeasure | measure = EArea |
||
) | const |
Compute the area density of a provided emitter or sensor sample with respect the direct sampling technique implemented in sampleDirect().
The current vertex is taken to be the reference point of the direct sampling technique.
scene | Pointer to the underlying scene |
mode | Specifies whether radiance or importance is being transported |
sample | An emitter or sensor sample |
measure | Specifies the measure of the queried component. This is necessary to handle scattering functions, whose components are defined on spaces with different measures. |
sample
conditioned on this vertex.
|
inline |
Return the abstract emitter associated with a sensor/emitter sample.
|
inline |
Return the component type associated with this vertex.
This currently only applies to surface interactions. The returned result will consist of flags in BSDF::EBSDFType.
|
inline |
Return the endpoint record associated with this node.
|
inline |
Return the endpoint record associated with this node (const)
Normal mitsuba::PathVertex::getGeometricNormal | ( | ) | const |
Return the geometric surface normal associated with this vertex.
Throws an exception when called on a supernode or a medium interaction
|
inline |
Return the intersection record associated with this node.
|
inline |
Return the intersection record associated with this node (const)
|
inline |
Return the medium sampling record associated with this node.
|
inline |
Return the medium sampling record associated with this node.
Point mitsuba::PathVertex::getPosition | ( | ) | const |
Return the position associated with this vertex.
Throws an exception when called on a supernode
|
inline |
Return the position sampling record associated with this node.
|
inline |
Return the position sampling record associated with this node (const)
|
inline |
Return the fractional pixel position associated with a sensor sample.
bool mitsuba::PathVertex::getSamplePosition | ( | const PathVertex * | succ, |
Point2 & | result | ||
) | const |
Special routine for sensor sample vertices: given a successor succ
, return its associated fractional pixel position.
v | Pointer to the target vertex |
result | Reference to a 2D point that will be set to the fractional pixel coordinates associated with succ . |
true
upon success (i.e. when the point is in the sensor's field of view) Normal mitsuba::PathVertex::getShadingNormal | ( | ) | const |
Return the shading surface normal associated with this vertex.
Throws an exception when called on a supernode or a medium interaction
const Medium* mitsuba::PathVertex::getTargetMedium | ( | const PathEdge * | predEdge, |
const PathVertex * | succ | ||
) | const |
Determine the medium that fills the space between the current vertex and a specified successor.
This function assumes that there is no surface between this
and succ
, hence it does not account for intermediate medium changes.
predEdge | Pointer to an edge that connects the current node to its predecessor |
succ | Pointer to the successor vertex in question |
this
and succ
const Medium* mitsuba::PathVertex::getTargetMedium | ( | const PathEdge * | predEdge, |
const Vector & | d | ||
) | const |
Determine the medium that fills the space in direction d
.
predEdge | Pointer to an edge that connects the current node to its predecessor |
d | A world-space direction |
(this->getPosition(), d)
Float mitsuba::PathVertex::getTime | ( | ) | const |
Return the time value associated with this node.
|
inline |
Return the type associated with this vertex.
|
inline |
Returns whether or not this vertex describes a 100% absorbing surface.
Such is the case on emitters/sensors that don't have an explicit BSDF assigned to them. It is useful to be able to query this to avoid some useless connection attempts involving these vertices.
|
inline |
Returns whether or not this vertex can be deterministically connected to other vertices.
This is the case when degenerate == false
and measure != EDiscrete
.
|
inline |
Returns whether or not this vertex is degenerate, i.e. its distribution has measure zero.
|
inline |
Returns whether or not this vertex describes a diffuse surface scattering interaction.
|
inline |
Is this vertex an emitter sample?
|
inline |
Is this vertex a emitter super-node?
|
inline |
Is this vertex a medium interaction?
|
inline |
Returns whether or not this vertex describes a "null" scattering interaction.
A null interaction is a degenerate scattering event with a Dirac delta peak in the forward direction. Apart from a potential influence on their weight, particles will pass through such an interface unchanged.
|
inline |
Check if the vertex lies on a surface.
|
inline |
Is this vertex a lens sample?
|
inline |
Is this vertex a sensor super-node?
|
inline |
Is this vertex a supernode?
|
inline |
Is this vertex a surface interaction?
void mitsuba::PathVertex::makeEndpoint | ( | const Scene * | scene, |
Float | time, | ||
ETransportMode | mode | ||
) |
Generate a path endpoint that can be used to start a random walk.
scene | Pointer to the underlying scene |
mode | Specifies the desired mode of transport, i.e. radiance or importance transport |
time | Denotes the time value that will be associated with this endpoint and any paths generated starting from there. |
|
inline |
Compare this vertex against another vertex.
bool mitsuba::PathVertex::operator== | ( | const PathVertex & | vertex | ) | const |
Compare this vertex against another vertex.
bool mitsuba::PathVertex::perturbDirection | ( | const Scene * | scene, |
const PathVertex * | pred, | ||
const PathEdge * | predEdge, | ||
PathEdge * | succEdge, | ||
PathVertex * | succ, | ||
const Vector & | d, | ||
Float | dist, | ||
EVertexType | desiredType, | ||
ETransportMode | mode | ||
) |
Create a perturbed successor vertex and edge.
This function behaves similar to sampleNext() in that it generates a successor edge and vertex.
The main difference is that the desired direction, distance, and type of the successor vertex are all specified, which makes the sampling process completely deterministic. This is useful for implementing path-space perturbation strategies.
This function only applies to non-supernode vertices.
scene | Pointer to the underlying scene |
pred | Pointer to the preceding vertex (if any) and NULL otherwise |
predEdge | Edge to the preceding edge (if any) and NULL otherwise |
succEdge | Pointer to an unused edge data structure, which will be filled with information about the edge between the current vertex and the new successor. |
succ | Pointer to an unused vertex data structure, which will be filled with information about the successor vertex |
d | Specifies the desired outgoing direction at the current vertex |
dist | Specifies the desired distance between the current vertex and succ (this only applies when desiredType=EMediumInteraction ) |
desiredType | Specifies the desired vertex type of succ . |
mode | Specifies whether radiance or importance is being transported |
true
on success Generate a path endpoint that can be used to start a random walk.
scene | Pointer to the underlying scene |
mode | Specifies the desired mode of transport, i.e. radiance or importance transport |
time | Denotes the time value that will be associated with this endpoint and any paths generated starting from there. |
Float mitsuba::PathVertex::perturbPositionPdf | ( | const PathVertex * | target, |
Float | stddev | ||
) | const |
Generate a path endpoint that can be used to start a random walk.
scene | Pointer to the underlying scene |
mode | Specifies the desired mode of transport, i.e. radiance or importance transport |
time | Denotes the time value that will be associated with this endpoint and any paths generated starting from there. |
bool mitsuba::PathVertex::propagatePerturbation | ( | const Scene * | scene, |
const PathVertex * | pred, | ||
const PathEdge * | predEdge, | ||
PathEdge * | succEdge, | ||
PathVertex * | succ, | ||
unsigned int | componentType, | ||
Float | dist, | ||
EVertexType | desiredType, | ||
ETransportMode | mode | ||
) |
Propagate a perturbation through an ideally specular interaction.
This function behaves similar to sampleNext() and perturbDirection() in that it generates a successor edge and vertex.
The main difference is that it only works for specular interactions, where the requested type of interaction (reflection/refraction) is additionally specified, which makese the sampling process completely deterministic. This is useful for implementing path-space perturbation strategies. For now, it is only used by the perturbations of Veach and Guibas.
This function only applies to surface interaction vertices.
scene | Pointer to the underlying scene |
pred | Pointer to the preceding vertex (if any) and NULL otherwise |
predEdge | Edge to the preceding edge (if any) and NULL otherwise |
succEdge | Pointer to an unused edge data structure, which will be filled with information about the edge between the current vertex and the new successor. |
dist | Specifies the desired distance between the current vertex and succ (this only applies when desiredType=EMediumInteraction ) |
desiredType | Specifies the desired vertex type of succ . |
componentType | Specifies the desired type of scattering interaction (equivalent to BSDF::typeMask) |
succ | Pointer to an unused vertex data structure, which will be filled with information about the successor vertex |
dist | Specifies the desired distance between the current vertex and succ (this only applies to medium interactions) |
mode | Specifies whether radiance or importance is being transported |
true
on success Spectrum mitsuba::PathVertex::sampleDirect | ( | const Scene * | scene, |
Sampler * | sampler, | ||
PathVertex * | endpoint, | ||
PathEdge * | edge, | ||
PathVertex * | sample, | ||
ETransportMode | mode | ||
) | const |
Direct sampling: given the current vertex as a reference sample an emitter (or sensor) position that has a nonzero emission (or response) towards it.
This can be seen as a generalization of direct illumination sampling that can be used for both emitter and sensor endpoints.
Ideally, the implementation should importance sample the product of the emission or response profile and the geometry term between the reference point and the sampled position. In practice, one of these usually has to be sacrificed.
scene | Pointer to the underlying scene |
sampler | Pointer to a sample generator |
endpoint | Unused vertex data structure, which will be configured as the endpoint associated with sample . |
edge | Unused edge data structure, which will be configured as the edge between endpoint and sample . |
sample | Unused vertex data structure, which will hold the sampled sensor or emitter position |
mode | Specifies whether radiance or importance is being transported |
bool mitsuba::PathVertex::sampleNext | ( | const Scene * | scene, |
Sampler * | sampler, | ||
const PathVertex * | pred, | ||
const PathEdge * | predEdge, | ||
PathEdge * | succEdge, | ||
PathVertex * | succ, | ||
ETransportMode | mode, | ||
bool | russianRoulette = false , |
||
Spectrum * | throughput = NULL |
||
) |
Sample the next vertex in a random walk using the default sampling technique implemented by the current vertex.
Given a vertex, its predecessor, as well as the edge in between them, this function samples a new successor edge and vertex.
scene | Pointer to the underlying scene |
sampler | Pointer to a sample generator |
pred | Pointer to the preceding vertex (if any) and NULL otherwise |
predEdge | Edge to the preceding edge (if any) and NULL otherwise |
succEdge | Pointer to an unused edge data structure, which will be filled with information about the edge between the current vertex and the newly sampled successor. |
succ | Pointer to an unused vertex data structure, which will be filled with information about the successor vertex |
mode | Specifies whether radiance or importance is being transported |
russianRoulette | Should russian roulette be used while sampling the successor? Note that the effects of this are only captured in the rrWeight field – the weight and pdf fields intentionally remain unchanged. |
throughput | If russian roulette is active, this parameter should point to a spectrum value that is used to record the aggregate path weight thus far. It will be updated automatically to account for the current interaction. |
true
on success int mitsuba::PathVertex::sampleSensor | ( | const Scene * | scene, |
Sampler * | sampler, | ||
const Point2i & | pixelPosition, | ||
PathEdge * | e0, | ||
PathVertex * | v1, | ||
PathEdge * | e1, | ||
PathVertex * | v2 | ||
) |
Sample the first vertices on a sensor subpath such that they contribute to a specified pixel in the output image.
This function samples the spatial and directional components of the sensor and is similar to calling sampleNext() two times in sequence starting from a sensor supernode. The main difference is that the resulting subpath passes through a specified pixel position, which is important to implement algorithms that parallelize rendering of images by processing it in separate blocks. If this function is called once for every pixel in the output image, the resulting path distribution is identical to what would have been obtained via sampleNext().
The function throws an exception when the current vertex is not a sensor supernode.
scene | Pointer to the underlying scene |
sampler | Pointer to a sample generator |
pixelPosition | Specifies the desired pixel position |
e0 | Pointer to the first edge on the sensor subpath |
e0 | Pointer to the first edge on the sensor subpath |
v1 | Pointer to the second vertex on the sensor subpath |
v2 | Pointer to the third vertex on the sensor subpath |
0
if sensor sampling failed, 1
if no surface/medium interaction was encountered, or 2
if all data structures were successfully filled) std::string mitsuba::PathVertex::toString | ( | ) | const |
Return a string representation of the information stored in this vertex.
bool mitsuba::PathVertex::update | ( | const Scene * | scene, |
const PathVertex * | pred, | ||
const PathVertex * | succ, | ||
ETransportMode | mode, | ||
EMeasure | measure = EArea |
||
) |
Given the specified predecessor and successor, update the cached values stored in this vertex.
pred | Pointer to the predecessor vertex (if any) and NULL otherwise |
succ | Pointer to the successor vertex (if any) and NULL otherwise |
mode | Specifies the direction of light transport |
false
when there is no throughput bool mitsuba::PathVertex::updateSamplePosition | ( | const PathVertex * | succ | ) |
Special routine for sensor sample vertices: given a successor succ
, update the fractional pixel position stored in the vertex.
v | Pointer to the target vertex |
true
upon success (i.e. when the point is in the sensor's field of view) bool mitsuba::PathVertex::verify | ( | const Scene * | scene, |
const PathVertex * | adjL, | ||
const PathVertex * | adjE, | ||
ETransportMode | mode, | ||
std::ostream & | os | ||
) | const |
Verify the cached values stored in this path vertex for consistency.
This function re-evaluates a series of quantities associated with this vertex and compares them to locally cached values including pdf, value, and degenerate. If any mismatch is found, the function sends debug output to a specified output stream and returns false
.
scene | Pointer to the underlying scene |
pred | Pointer to the preceding vertex (if any) and NULL otherwise |
succ | Pointer to the successor vertex (if any) and NULL otherwise |
mode | Transport mode – disambiguates the meaning of pred and succ . |
os | Target output stream for error messages |
uint16_t mitsuba::PathVertex::componentType |
When the current vertex supports sampling from several components (this currently only applies to BSDF lobes), this attribute records the type sampled component.
Otherwise, it will be set to zero.
Auxilary node-depependent data associated with each vertex.
This "payload" field is large enough to describe any possible kind of vertex. Currently, it is cast to the desired type of data structure which wreaks havoc with strict aliasing (and hence it is disabled for all bidirectional code).
Once C++11 is widely supported across all target platforms, this should be replaced by an unrestricted union.
bool mitsuba::PathVertex::degenerate |
Denotes whether this vertex only supports sampling from degenerate distributions.
It's useful to cache this information, since it allows to quickly determine when certain pairs of vertices cannot be deterministically connected.
Examples of degenerate vertices are surface interactions with dielectric boundaries and certain special cases. For instance, the sensor supernode can be degenerate when the used sensor does not cover any area (e.g. because it is a point camera).
EMeasure mitsuba::PathVertex::measure |
Denotes the measure associated with the probability densities stored in pdf.
Certain vertices use sampling methods, whose probability mass lies on domains that have different associated measures. An example would be a surface interaction with a smooth plastic material, where the specular reflection component is degenerate and the glossy reflection component is non-degenerate.
This attribute stores the actual measure (an enumeration item of type EMeasure) and therefore clarifies whether or not a degenerate component was sampled. When no sampling event was generated yet, it is undefined.
Currently, only three values are permissible: EArea, EDiscrete, or EInvalidMeasure.
Float mitsuba::PathVertex::pdf[ETransportModes] |
Area density of the two adjacent vertices.
This field stores the density of the predecessor and sucessor nodes with respect of the sampling technique implemented by sampleNext(). The measure of this value is specified by the measure field (generally, it is the density per unit area).
When one of the adjacent vertices is a medium interaction (i.e. it is not located on a surface), the stored probability will specify the density on a hypothetical surface oriented perpendicularly to the transport direction.
Note that this field does not account for medium-related terms. When an adjacent vertex is a medium interaction, its volume density can be recovered by computing the product of pdf
and PathEdge::pdf of the associated transport edge.
Float mitsuba::PathVertex::rrWeight |
Termination weight due to russian roulette (used by BDPT)
EVertexType mitsuba::PathVertex::type |
Specifies one of several possible path vertex types.
Spectrum mitsuba::PathVertex::weight[ETransportModes] |
Measurement contribution weight.
This field stores the terms of the path-space measurement contribution function that are coupled to this specific vertex, divided by the density of the adjacent vertices in the radiance and importance transport directions (hence, it is an array with two entries).
More precisely, it stores
\[ f(\mathbf{x}_{i-1}\to \mathbf{x}_i\to\mathbf{x}_{i+1})\, G(\mathbf{x}_i\leftrightarrow\mathbf{x}_{i+1})\,p_A(\mathbf{x}_{i-1}\to \mathbf{x}_i\to\mathbf{x}_{i+1})^{-1} \]
and
\[ f(\mathbf{x}_{i+1}\to \mathbf{x}_i\to\mathbf{x}_{i-1})\, G(\mathbf{x}_i\leftrightarrow\mathbf{x}_{i-1})\,p_A(\mathbf{x}_{i+1}\to \mathbf{x}_i\to\mathbf{x}_{i-1})^{-1} \]
Where \(G\) is the geometric term, \(p_A\) is an area density, and increasing indices are closer to the sensor. Generally much cancellation will occur in the above expressions. For instance, for a surface iteractions, this is equal to the BRDF times a cosine foreshortening factor divided by the solid angle density of the default sampling method.
Note that this field does not account for medium-related terms. These can be found in PathEdge::weight