Fermat
Classes | Functions
PTLibCore

Detailed Description

A module defining core path tracing functions to process path vertices, perform NEE and process its generated samples

Classes

union  PixelInfo
 
struct  PTContextBase< TPTOptions >
 

Functions

FERMAT_DEVICE FERMAT_FORCEINLINE void per_warp_atomic_add (uint64 *ptr, uint64 val)
 
template<typename TPTContext >
FERMAT_HOST_DEVICE void compute_per_bounce_options (TPTContext &context, const RenderingContextView &renderer)
 
template<typename TPTContext >
FERMAT_DEVICE MaskedRay generate_primary_ray (TPTContext &context, RenderingContextView &renderer, const uint2 pixel, cugar::Vector3f U, cugar::Vector3f V, cugar::Vector3f W)
 
template<typename TPTContext >
FERMAT_DEVICE MaskedRay generate_primary_ray (TPTContext &context, RenderingContextView &renderer, const uint2 pixel)
 
template<typename TPTContext , typename TPTVertexProcessor >
FERMAT_DEVICE void solve_occlusion (TPTContext &context, TPTVertexProcessor &vertex_processor, RenderingContextView &renderer, const bool shadow_hit, const PixelInfo pixel_info, const cugar::Vector3f w, const cugar::Vector3f w_d, const cugar::Vector3f w_g, const uint32 vertex_info=uint32(-1), const uint32 nee_vertex_id=uint32(-1), const uint32 nee_sample_id=uint32(-1))
 
template<typename TPTContext >
FERMAT_DEVICE float vertex_sample (const uint2 pixel, TPTContext &context, const uint32 i)
 
template<typename TPTContext , typename TPTVertexProcessor >
FERMAT_DEVICE bool shade_vertex (TPTContext &context, TPTVertexProcessor &vertex_processor, RenderingContextView &renderer, const uint32 bounce, const PixelInfo pixel_info, const uint2 pixel, const MaskedRay &ray, const Hit hit, const cugar::Vector4f w, const uint32 prev_vertex_info=uint32(-1), const uint32 prev_nee_vertex_id=uint32(-1), const cugar::Vector2f cone=cugar::Vector2f(0))
 

Function Documentation

◆ compute_per_bounce_options()

template<typename TPTContext >
FERMAT_HOST_DEVICE void compute_per_bounce_options ( TPTContext &  context,
const RenderingContextView renderer 
)

compute options relative to the current bounce and set them in the TPTContext class:

  • TPTContext::do_nee : whether to perform NEE
  • TPTContext::do_accumulate_emissive : whether to accumulate emissive surface hits
  • TPTContext::do_scatter : whether to perform scattering

◆ generate_primary_ray() [1/2]

template<typename TPTContext >
FERMAT_DEVICE MaskedRay generate_primary_ray ( TPTContext &  context,
RenderingContextView renderer,
const uint2  pixel,
cugar::Vector3f  U,
cugar::Vector3f  V,
cugar::Vector3f  W 
)

generate a primary ray based on the given pixel index

Template Parameters
TPTContextA path tracing context
Parameters
contextthe path tracing context
rendererthe rendering context
pixelthe unpacked 2d pixel index
Uthe horizontal (+X) camera frame vector
Vthe vertical (+Y) camera frame vector
Wthe depth (+Z) camera frame vector

◆ generate_primary_ray() [2/2]

template<typename TPTContext >
FERMAT_DEVICE MaskedRay generate_primary_ray ( TPTContext &  context,
RenderingContextView renderer,
const uint2  pixel 
)

generate a primary ray based on the given pixel index

Template Parameters
TPTContextA path tracing context
Parameters
contextthe path tracing context
rendererthe rendering context
pixelthe unpacked 2d pixel index

◆ shade_vertex()

template<typename TPTContext , typename TPTVertexProcessor >
FERMAT_DEVICE bool shade_vertex ( TPTContext &  context,
TPTVertexProcessor &  vertex_processor,
RenderingContextView renderer,
const uint32  bounce,
const PixelInfo  pixel_info,
const uint2  pixel,
const MaskedRay ray,
const Hit  hit,
const cugar::Vector4f  w,
const uint32  prev_vertex_info = uint32(-1),
const uint32  prev_nee_vertex_id = uint32(-1),
const cugar::Vector2f  cone = cugar::Vector2f(0) 
)

processes a path vertex, performing the following three steps:

  • sampling NEE
  • accumulating emissive surface hits
  • scattering
Template Parameters
TPTContextA path tracing context, which must adhere to the TPTContext interface
TPTVertexProcessorA vertex processor, which must adhere to the TPTVertexProcessor interface
Parameters
contextthe path tracing context
vertex_processorthe vertex processor
rendererthe rendering context
pixel_infothe packed pixel info
pixelthe unpacked 2d pixel index
raythe incoming ray
hitthe hit information
wthe current path weight
prev_nee_vertex_idthe NEE slot corresponding to the previous vertex
conethe incoming ray cone

◆ solve_occlusion()

template<typename TPTContext , typename TPTVertexProcessor >
FERMAT_DEVICE void solve_occlusion ( TPTContext &  context,
TPTVertexProcessor &  vertex_processor,
RenderingContextView renderer,
const bool  shadow_hit,
const PixelInfo  pixel_info,
const cugar::Vector3f  w,
const cugar::Vector3f  w_d,
const cugar::Vector3f  w_g,
const uint32  vertex_info = uint32(-1),
const uint32  nee_vertex_id = uint32(-1),
const uint32  nee_sample_id = uint32(-1) 
)

processes a NEE sample, using occlusion information

Template Parameters
TPTContextA path tracing context, which must adhere to the TPTContext interface
TPTVertexProcessorA vertex processor, which must adhere to the TPTVertexProcessor interface
Parameters
contextthe path tracing context
vertex_processorthe vertex processor
rendererthe rendering context
shadow_hita bit indicating whether the sample is occluded or not
pixel_infothe packed pixel info
wthe total sample weight
w_dthe diffuse sample weight
w_gthe glossy sample weight
nee_vertex_idthe current NEE slot computed by the direct lighting engine
nee_sample_idthe current NEE cluster computed by the direct lighting engine

◆ vertex_sample()

template<typename TPTContext >
FERMAT_DEVICE float vertex_sample ( const uint2  pixel,
TPTContext &  context,
const uint32  i 
)

return the i-th dimensional sample for this vertex, with i in [0,6[