Fermat
Classes | Macros | Functions
PathModule

Detailed Description

This module defines the basic classes used to represent and manipulate light paths throughout Fermat, particularly:
  • Path : represent a light path in compact form, storing its vertex ids only
  • BidirPath : represent a bidirectional path in compact form, storing its vertex ids only

Classes

struct  Path
 
struct  BidirPath
 
struct  PathCache< T >
 
struct  BsdfInverse
 

Macros

#define MAXIMUM_INVERSION_ERROR   1.0e-6f
 
#define TRANSFORM_PDF(_p, _w, _w_norm)   (_p *= _w_norm / _w)
 

Functions

template<typename TRandomGenerator , typename BsdfComponent >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE bool invert_layer (const BsdfComponent &bsdf_comp, const VertexGeometry &v_prev, const cugar::Vector3f &in, const cugar::Vector3f &out, TRandomGenerator &random, cugar::Vector3f &z, float &p, float &p_proj)
 
template<typename TRandomGenerator >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE bool invert_bsdf (const Bsdf &bsdf, const VertexGeometry &v_prev, const cugar::Vector3f &in, const cugar::Vector3f &out, TRandomGenerator &random, cugar::Vector3f &z, float &p, float &p_proj, bool RR=true)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE void inversion_pdf (const Bsdf &bsdf, const VertexGeometry &v_prev, const cugar::Vector3f &in, const cugar::Vector3f &out, cugar::Vector3f &z, float &p, float &p_proj)
 
template<typename PathType , typename TRandomGenerator >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE bool invert_eye_subpath (const PathType &path, const uint32 t, const uint32 t_ext, float *out_Z, float *out_pdf, const RenderingContextView &renderer, TRandomGenerator &random)
 
template<typename PathType >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE float eye_subpath_inversion_pdf (const PathType &path, const uint32 t, const uint32 t_ext, const float *out_Z, const RenderingContextView &renderer)
 
template<typename PathType , typename TRandomGenerator >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE bool invert_light_subpath (const PathType &path, const uint32 s, const uint32 s_ext, float *out_Z, float *out_pdf, const RenderingContextView &renderer, TRandomGenerator &random)
 
template<typename PathType >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE float light_subpath_inversion_pdf (const PathType &path, const uint32 s, const uint32 s_ext, const float *out_Z, const RenderingContextView &renderer)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE void BsdfInverse::setup (ComponentSelectionStrategy _strategy, const Bsdf &bsdf, const VertexGeometry &geom, const cugar::Vector3f &in, const cugar::Vector3f &out, const bool _RR=false)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE bool BsdfInverse::precompute_component_selection_coefficients ()
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE Bsdf::ComponentType BsdfInverse::sample_component (const float v) const
 
template<typename TRandomGenerator >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE bool BsdfInverse::invert (const Bsdf &bsdf, const VertexGeometry &geom, const cugar::Vector3f &in, const cugar::Vector3f &out, TRandomGenerator &random, cugar::Vector3f &z, BsdfInverse::PdfType pdf_type=BsdfInverse::kDirectTransformPdf, float *p=NULL, float *p_proj=NULL)
 
template<typename TRandomGenerator >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE bool BsdfInverse::invert_component (const Bsdf &bsdf, const VertexGeometry &geom, const cugar::Vector3f &in, const cugar::Vector3f &out, const Bsdf::ComponentType out_comp, TRandomGenerator &random, cugar::Vector3f &z, const bool output_global_coordinates=true)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE float BsdfInverse::pdf (const Bsdf::ComponentType out_comp, cugar::SphericalMeasure measure=cugar::kProjectedSolidAngle, const bool weighted=false) const
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE float BsdfInverse::pdf_comp (const Bsdf::ComponentType out_comp) const
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE float BsdfInverse::weight (const Bsdf::ComponentType out_comp) const
 

Function Documentation

◆ invert()

template<typename TRandomGenerator >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE bool BsdfInverse::invert ( const Bsdf bsdf,
const VertexGeometry geom,
const cugar::Vector3f in,
const cugar::Vector3f out,
TRandomGenerator &  random,
cugar::Vector3f z,
BsdfInverse::PdfType  pdf_type = BsdfInverse::kDirectTransformPdf,
float *  p = NULL,
float *  p_proj = NULL 
)

invert a bsdf by randomly chosing a component

◆ invert_component()

template<typename TRandomGenerator >
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE bool BsdfInverse::invert_component ( const Bsdf bsdf,
const VertexGeometry geom,
const cugar::Vector3f in,
const cugar::Vector3f out,
const Bsdf::ComponentType  out_comp,
TRandomGenerator &  random,
cugar::Vector3f z,
const bool  output_global_coordinates = true 
)

invert a given component of a bsdf

◆ pdf()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE float BsdfInverse::pdf ( const Bsdf::ComponentType  out_comp,
cugar::SphericalMeasure  measure = cugar::kProjectedSolidAngle,
const bool  weighted = false 
) const

return the Jacobian determinant of the inverse transform for a given component; note that the returned Jacobian determinant is equal to the pdf of sampling that component, by definition of pdf of a transformed variable. In fact, if U is a uniform r.v. in the primary sample space, and X is the transformed path space variable, X = T(U), we have:

P(X) = P(T_inv(X)) * |J[T_inv](X)| = P(U) * |J[T_inv](X)| = |J[T_inv](X)|

◆ pdf_comp()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE float BsdfInverse::pdf_comp ( const Bsdf::ComponentType  out_comp) const

return the pdf with which a given component is selected by the inversion method.

◆ sample_component()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE Bsdf::ComponentType BsdfInverse::sample_component ( const float  v) const

sample a component given a random number

◆ setup()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE void BsdfInverse::setup ( ComponentSelectionStrategy  _strategy,
const Bsdf bsdf,
const VertexGeometry geom,
const cugar::Vector3f in,
const cugar::Vector3f out,
const bool  _RR = false 
)

setup the inverter for a specific bsdf and geometry configuration: note that all subsequent calls to other methods of this class need to use the same configuration, unless setup() is called again with different parameters

◆ weight()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE float BsdfInverse::weight ( const Bsdf::ComponentType  out_comp) const

return the sampling weight applied to a given component.