Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::PathVertex Struct Reference

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 MediumgetTargetMedium (const PathEdge *predEdge, const PathVertex *succ) const
 Determine the medium that fills the space between the current vertex and a specified successor. More...
 
const MediumgetTargetMedium (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...
 
EndpointRecordgetEndpointRecord ()
 Return the endpoint record associated with this node. More...
 
const EndpointRecordgetEndpointRecord () const
 Return the endpoint record associated with this node (const) More...
 
PositionSamplingRecordgetPositionSamplingRecord ()
 Return the position sampling record associated with this node. More...
 
const PositionSamplingRecordgetPositionSamplingRecord () const
 Return the position sampling record associated with this node (const) More...
 
IntersectiongetIntersection ()
 Return the intersection record associated with this node. More...
 
const IntersectiongetIntersection () const
 Return the intersection record associated with this node (const) More...
 
MediumSamplingRecordgetMediumSamplingRecord ()
 Return the medium sampling record associated with this node. More...
 
const MediumSamplingRecordgetMediumSamplingRecord () const
 Return the medium sampling record associated with this node. More...
 
const Point2getSamplePosition () const
 Return the fractional pixel position associated with a sensor sample. More...
 
const AbstractEmittergetAbstractEmitter () 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...
 
PathVertexclone (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...
 

Detailed Description

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.

Author
Wenzel Jakob

Member Enumeration Documentation

anonymous enum

Denotes the size of the auxiliary data section associated with each node.

Enumerator
EDataSize 

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.

Enumerator
EInvalid 

Invalid/uninitialized vertex.

ESensorSupernode 

Special sensor 'supernode' – just before the sensor sample.

EEmitterSupernode 

Special emitter 'supernode' – just before the emitter sample.

ESensorSample 

Sampled position on the surface of a sensor.

EEmitterSample 

Sampled position on the surface of an emitter.

ESurfaceInteraction 

Interaction with a scene surface.

EMediumInteraction 

Interaction with a participating medium.

ESupernode 

Union of the two supernode types.

ENormal 

Union of all other vertex types.

Member Function Documentation

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.

Parameters
sceneA pointer to the underlying scene
desiredDesired type after the cast
Returns
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 bool mitsuba::PathVertex::connect ( const Scene scene,
const PathVertex pred,
const PathEdge predEdge,
PathVertex vs,
PathEdge edge,
PathVertex vt,
const PathEdge succEdge,
const PathVertex succ 
)
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.

Parameters
scenePointer to the underlying scene
predPointer to the predecessor vertex of vs (towards the emitter)
predEdgePointer to an edge between pred and vs.
vsLast vertex of the emitter subpath to be connected. The cached values of this vertex will be updated should the connection attempt succeed.
edgePointer to an unused edge data structure, which will be annotated with information about the medium-related transport between vs and vt.
vtLast vertex of the sensor subpath to be connected. The cached values of this vertex will be updated should the connection attempt succeed.
succEdgePointer to an edge between vt and succ.
succPointer to the successor vertex of vt (towards the sensor)
Returns
true upon success, false when there is no throughput or an inconsistency has been detected.
static bool mitsuba::PathVertex::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 
)
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.

Parameters
scenePointer to the underlying scene
predPointer to the preceding vertex (if any) and NULL otherwise
succPointer to the successor vertex (if any) and NULL otherwise
modeSpecifies whether radiance or importance is being transported
measureSpecifies the measure of the queried component. This is necessary to handle mixture scattering functions, whose components are defined on spaces with different measures.
Returns
The contribution weighting factor
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.

Parameters
scenePointer to the underlying scene
predPointer to the preceding vertex (if any) and NULL otherwise
succPointer to the successor vertex (if any) and NULL otherwise
modeSpecifies whether radiance or importance is being transported
measureSpecifies the measure of the queried component. This is necessary to handle mixture scattering functions, whose components are defined on spaces with different measures.
Returns
The computed probability density
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.

Parameters
scenePointer to the underlying scene
modeSpecifies whether radiance or importance is being transported
sampleAn emitter or sensor sample
measureSpecifies the measure of the queried component. This is necessary to handle scattering functions, whose components are defined on spaces with different measures.
Returns
The density of sample conditioned on this vertex.
const AbstractEmitter* mitsuba::PathVertex::getAbstractEmitter ( ) const
inline

Return the abstract emitter associated with a sensor/emitter sample.

unsigned int mitsuba::PathVertex::getComponentType ( ) const
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.

EndpointRecord& mitsuba::PathVertex::getEndpointRecord ( )
inline

Return the endpoint record associated with this node.

const EndpointRecord& mitsuba::PathVertex::getEndpointRecord ( ) const
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

Intersection& mitsuba::PathVertex::getIntersection ( )
inline

Return the intersection record associated with this node.

const Intersection& mitsuba::PathVertex::getIntersection ( ) const
inline

Return the intersection record associated with this node (const)

MediumSamplingRecord& mitsuba::PathVertex::getMediumSamplingRecord ( )
inline

Return the medium sampling record associated with this node.

const MediumSamplingRecord& mitsuba::PathVertex::getMediumSamplingRecord ( ) const
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

PositionSamplingRecord& mitsuba::PathVertex::getPositionSamplingRecord ( )
inline

Return the position sampling record associated with this node.

const PositionSamplingRecord& mitsuba::PathVertex::getPositionSamplingRecord ( ) const
inline

Return the position sampling record associated with this node (const)

const Point2& mitsuba::PathVertex::getSamplePosition ( ) 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.

Parameters
vPointer to the target vertex
resultReference to a 2D point that will be set to the fractional pixel coordinates associated with succ.
Returns
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.

Parameters
predEdgePointer to an edge that connects the current node to its predecessor
succPointer to the successor vertex in question
Returns
The medium between 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.

Parameters
predEdgePointer to an edge that connects the current node to its predecessor
dA world-space direction
Returns
The medium containing the ray (this->getPosition(), d)
Float mitsuba::PathVertex::getTime ( ) const

Return the time value associated with this node.

EVertexType mitsuba::PathVertex::getType ( ) const
inline

Return the type associated with this vertex.

bool mitsuba::PathVertex::isAbsorbing ( ) const
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.

bool mitsuba::PathVertex::isConnectable ( ) const
inline

Returns whether or not this vertex can be deterministically connected to other vertices.

This is the case when degenerate == false and measure != EDiscrete.

bool mitsuba::PathVertex::isDegenerate ( ) const
inline

Returns whether or not this vertex is degenerate, i.e. its distribution has measure zero.

bool mitsuba::PathVertex::isDiffuseInteraction ( ) const
inline

Returns whether or not this vertex describes a diffuse surface scattering interaction.

bool mitsuba::PathVertex::isEmitterSample ( ) const
inline

Is this vertex an emitter sample?

bool mitsuba::PathVertex::isEmitterSupernode ( ) const
inline

Is this vertex a emitter super-node?

bool mitsuba::PathVertex::isMediumInteraction ( ) const
inline

Is this vertex a medium interaction?

bool mitsuba::PathVertex::isNullInteraction ( ) const
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.

bool mitsuba::PathVertex::isOnSurface ( ) const
inline

Check if the vertex lies on a surface.

bool mitsuba::PathVertex::isSensorSample ( ) const
inline

Is this vertex a lens sample?

bool mitsuba::PathVertex::isSensorSupernode ( ) const
inline

Is this vertex a sensor super-node?

bool mitsuba::PathVertex::isSupernode ( ) const
inline

Is this vertex a supernode?

bool mitsuba::PathVertex::isSurfaceInteraction ( ) const
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.

Parameters
scenePointer to the underlying scene
modeSpecifies the desired mode of transport, i.e. radiance or importance transport
timeDenotes the time value that will be associated with this endpoint and any paths generated starting from there.
bool mitsuba::PathVertex::operator!= ( const PathVertex vertex) const
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.

Parameters
scenePointer to the underlying scene
predPointer to the preceding vertex (if any) and NULL otherwise
predEdgeEdge to the preceding edge (if any) and NULL otherwise
succEdgePointer to an unused edge data structure, which will be filled with information about the edge between the current vertex and the new successor.
succPointer to an unused vertex data structure, which will be filled with information about the successor vertex
dSpecifies the desired outgoing direction at the current vertex
distSpecifies the desired distance between the current vertex and succ (this only applies when desiredType=EMediumInteraction)
desiredTypeSpecifies the desired vertex type of succ.
modeSpecifies whether radiance or importance is being transported
Returns
true on success
bool mitsuba::PathVertex::perturbPosition ( const Scene scene,
Sampler sampler,
Float  stddev 
)

Generate a path endpoint that can be used to start a random walk.

Parameters
scenePointer to the underlying scene
modeSpecifies the desired mode of transport, i.e. radiance or importance transport
timeDenotes 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.

Parameters
scenePointer to the underlying scene
modeSpecifies the desired mode of transport, i.e. radiance or importance transport
timeDenotes 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.

Parameters
scenePointer to the underlying scene
predPointer to the preceding vertex (if any) and NULL otherwise
predEdgeEdge to the preceding edge (if any) and NULL otherwise
succEdgePointer to an unused edge data structure, which will be filled with information about the edge between the current vertex and the new successor.
distSpecifies the desired distance between the current vertex and succ (this only applies when desiredType=EMediumInteraction)
desiredTypeSpecifies the desired vertex type of succ.
componentTypeSpecifies the desired type of scattering interaction (equivalent to BSDF::typeMask)
succPointer to an unused vertex data structure, which will be filled with information about the successor vertex
distSpecifies the desired distance between the current vertex and succ (this only applies to medium interactions)
modeSpecifies whether radiance or importance is being transported
Returns
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.

Parameters
scenePointer to the underlying scene
samplerPointer to a sample generator
endpointUnused vertex data structure, which will be configured as the endpoint associated with sample.
edgeUnused edge data structure, which will be configured as the edge between endpoint and sample.
sampleUnused vertex data structure, which will hold the sampled sensor or emitter position
modeSpecifies whether radiance or importance is being transported
Returns
The emitted radiance or importance divided by the sample probability per unit area per unit solid angle.
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.

Parameters
scenePointer to the underlying scene
samplerPointer to a sample generator
predPointer to the preceding vertex (if any) and NULL otherwise
predEdgeEdge to the preceding edge (if any) and NULL otherwise
succEdgePointer to an unused edge data structure, which will be filled with information about the edge between the current vertex and the newly sampled successor.
succPointer to an unused vertex data structure, which will be filled with information about the successor vertex
modeSpecifies whether radiance or importance is being transported
russianRouletteShould 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.
throughputIf 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.
Returns
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.

Parameters
scenePointer to the underlying scene
samplerPointer to a sample generator
pixelPositionSpecifies the desired pixel position
e0Pointer to the first edge on the sensor subpath
e0Pointer to the first edge on the sensor subpath
v1Pointer to the second vertex on the sensor subpath
v2Pointer to the third vertex on the sensor subpath
Returns
The number of successful sampling operations (i.e. 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.

Parameters
predPointer to the predecessor vertex (if any) and NULL otherwise
succPointer to the successor vertex (if any) and NULL otherwise
modeSpecifies the direction of light transport
Returns
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.

Parameters
vPointer to the target vertex
Returns
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.

Parameters
scenePointer to the underlying scene
predPointer to the preceding vertex (if any) and NULL otherwise
succPointer to the successor vertex (if any) and NULL otherwise
modeTransport mode – disambiguates the meaning of pred and succ.
osTarget output stream for error messages

Member Data Documentation

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.

uint8_t mitsuba::PathVertex::data[EDataSize]

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.

See Also
EMeasure
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.

See Also
EVertexType
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


The documentation for this struct was generated from the following file: