Fermat
Modules | Classes | Macros | Functions | Variables
BPTLib

Detailed Description

This module provides a flexible bidirectional path tracing library, thought to be as performant as possible and yet vastly configurable at compile-time. For more information, see the BPTLib page.

Modules

 BPTLibCore
 

Classes

struct  BPTContextBase< TBPTOptions >
 
struct  BPTConfigBase
 
struct  SampleSinkBase
 
struct  BPTOptionsBase
 
struct  BPTQueuesView
 
struct  BPTQueuesStorage
 
struct  TiledLightSubpathPrimaryCoords
 
struct  PerPixelEyeSubpathPrimaryCoords
 
struct  PerturbedPrimaryCoords
 

Macros

#define SECONDARY_EYE_VERTICES_BLOCKSIZE   128
 
#define SECONDARY_EYE_VERTICES_CTA_BLOCKS   6
 
#define SECONDARY_LIGHT_VERTICES_BLOCKSIZE   128
 
#define SECONDARY_LIGHT_VERTICES_CTA_BLOCKS   6
 
#define BPT_FULL_BSDF_EVALUATION   1
 

Functions

template<typename TPrimaryCoordinates , typename TBPTContext , typename TBPTConfig >
void bpt::sample_light_subpaths (const uint32 n_light_paths, TPrimaryCoordinates primary_coords, TBPTContext &context, const TBPTConfig &config, RenderingContext &renderer, RenderingContextView &renderer_view)
 
template<typename TSampleSink , typename TBPTContext >
void bpt::solve_shadows (TSampleSink sample_sink, TBPTContext &context, RenderingContext &renderer, RenderingContextView &renderer_view)
 
template<typename TPrimaryCoordinates , typename TSampleSink , typename TBPTContext , typename TBPTConfig >
void bpt::sample_eye_subpaths (const uint32 n_eye_paths, const uint32 n_light_paths, TPrimaryCoordinates primary_coords, TSampleSink sample_sink, TBPTContext &context, const TBPTConfig &config, RenderingContext &renderer, RenderingContextView &renderer_view, const bool lazy_shadows=false)
 
template<typename TEyePrimaryCoordinates , typename TLightPrimaryCoordinates , typename TSampleSink , typename TBPTContext , typename TBPTConfig >
void bpt::sample_paths (const uint32 n_eye_paths, const uint32 n_light_paths, TEyePrimaryCoordinates eye_primary_coords, TLightPrimaryCoordinates light_primary_coords, TSampleSink sample_sink, TBPTContext &context, const TBPTConfig &config, RenderingContext &renderer, RenderingContextView &renderer_view, const bool lazy_shadows=false)
 
template<typename TSampleSink , typename TBPTContext , typename TBPTConfig >
void bpt::light_tracing (const uint32 n_light_paths, TSampleSink sample_sink, TBPTContext &context, const TBPTConfig &config, RenderingContext &renderer, RenderingContextView &renderer_view)
 
template<typename TBPTContext , typename TBPTConfig >
__global__ void bpt::light_tracing_kernel (const uint32 n_light_paths, TBPTContext context, RenderingContextView renderer, TBPTConfig config)
 
template<typename TBPTContext , typename TBPTConfig >
void bpt::light_tracing (const uint32 n_light_paths, TBPTContext &context, RenderingContextView &renderer, TBPTConfig &config)
 
template<typename TSampleSink , typename TBPTContext >
__global__ void bpt::solve_occlusions_kernel (const uint32 in_queue_size, TSampleSink sample_sink, TBPTContext context, RenderingContextView renderer)
 
template<typename TSampleSink , typename TBPTContext >
void bpt::solve_occlusions (const uint32 in_queue_size, TSampleSink sample_sink, TBPTContext context, RenderingContextView renderer)
 
template<typename TPrimaryCoordinates , typename TBPTContext , typename TBPTConfig >
__global__ void bpt::generate_primary_light_vertices_kernel (const uint32 n_light_paths, TPrimaryCoordinates primary_coords, TBPTContext context, RenderingContextView renderer, const TBPTConfig config)
 
template<typename TPrimaryCoordinates , typename TBPTContext , typename TBPTConfig >
void bpt::generate_primary_light_vertices (const uint32 n_light_paths, TPrimaryCoordinates primary_coords, TBPTContext context, RenderingContextView renderer, const TBPTConfig config)
 
template<typename TPrimaryCoordinates , typename TBPTContext , typename TBPTConfig >
__global__ bpt::__launch_bounds__ (SECONDARY_LIGHT_VERTICES_BLOCKSIZE, SECONDARY_LIGHT_VERTICES_CTA_BLOCKS) void process_secondary_light_vertices_kernel(const uint32 in_queue_size
 
 bpt::if (thread_id< in_queue_size) process_secondary_light_vertex(thread_id
 
template<typename TPrimaryCoordinates , typename TBPTContext , typename TBPTConfig >
void bpt::process_secondary_light_vertices (const uint32 in_queue_size, const uint32 n_light_paths, TPrimaryCoordinates primary_coords, TBPTContext context, RenderingContextView renderer, const TBPTConfig config)
 
template<typename TPrimaryCoordinates , typename TBPTContext , typename TBPTConfig >
__global__ void bpt::generate_primary_eye_vertices_kernel (const uint32 n_eye_paths, const uint32 n_light_paths, TPrimaryCoordinates primary_coords, TBPTContext context, RenderingContextView renderer, const TBPTConfig config)
 
template<typename TPrimaryCoordinates , typename TBPTConfig , typename TBPTContext >
void bpt::generate_primary_eye_vertices (const uint32 n_eye_paths, const uint32 n_light_paths, TPrimaryCoordinates primary_coords, TBPTContext context, RenderingContextView renderer, const TBPTConfig config)
 
template<typename TSampleSink , typename TPrimaryCoordinates , typename TBPTContext , typename TBPTConfig >
__global__ bpt::__launch_bounds__ (SECONDARY_EYE_VERTICES_BLOCKSIZE, SECONDARY_EYE_VERTICES_CTA_BLOCKS) void process_secondary_eye_vertices_kernel(const uint32 in_queue_size
 
template<typename TSampleSink , typename TPrimaryCoordinates , typename TBPTContext , typename TBPTConfig >
void bpt::process_secondary_eye_vertices (const uint32 in_queue_size, const uint32 n_eye_paths, const uint32 n_light_paths, TSampleSink sink, TPrimaryCoordinates primary_coords, TBPTContext context, RenderingContextView renderer, const TBPTConfig config)
 

Variables

__global__ const uint32 bpt::n_light_paths
 
__global__ const uint32 TPrimaryCoordinates bpt::primary_coords
 
__global__ const uint32 TPrimaryCoordinates TBPTContext bpt::context
 
__global__ const uint32 TPrimaryCoordinates TBPTContext RenderingContextView bpt::renderer
 
__global__ const uint32 TPrimaryCoordinates TBPTContext RenderingContextView const TBPTConfig bpt::config
 
__global__ const uint32 bpt::n_eye_paths
 
__global__ const uint32 const uint32 TSampleSink bpt::sink
 

Function Documentation

◆ light_tracing()

template<typename TSampleSink , typename TBPTContext , typename TBPTConfig >
void bpt::light_tracing ( const uint32  n_light_paths,
TSampleSink  sample_sink,
TBPTContext &  context,
const TBPTConfig &  config,
RenderingContext renderer,
RenderingContextView renderer_view 
)
A host function dispatching a series of kernels to process pure light tracing paths. Specifically, this function executes the following two functions:
This function needs to be called after a previous call to generate_light_subpaths(), as it assumes a set of light subpaths have already been sampled and it is possible to connect them to the camera.
Template Parameters
TSampleSinka sample sink, specifying what to do with each generated path sample, see SampleSinkAnchor
TBPTContexta bidirectional path tracing context class, see BPTContextBase
TBPTConfiga policy class controlling the behaviour of the path sampling process, see BPTConfigBase

◆ sample_eye_subpaths()

template<typename TPrimaryCoordinates , typename TSampleSink , typename TBPTContext , typename TBPTConfig >
void bpt::sample_eye_subpaths ( const uint32  n_eye_paths,
const uint32  n_light_paths,
TPrimaryCoordinates  primary_coords,
TSampleSink  sample_sink,
TBPTContext &  context,
const TBPTConfig &  config,
RenderingContext renderer,
RenderingContextView renderer_view,
const bool  lazy_shadows = false 
)
A host function dispatching a series of kernels to sample a given number of eye subpaths. The generated subpaths are controlled by a user-defined set of primary space coordinates. Specifically, this function executes a pipeline comprised of the following kernels:
  • generate_primary_eye_vertices()
  • RTContext::trace()
  • process_secondary_eye_vertices()
  • solve_shadows()
This function needs to be called after a previous call to generate_light_subpaths(), as it assumes a set of light subpaths have already been sampled and it is possible to sample and perform connections between the pre-existing light vertices and each new eye vertex. A templated sample sink class specifies what to do with the full light path samples generated in this phase (i.e. the paths hitting an emissive surface), while the generated "connection" samples are stored in a queue controlled by the templated policy config class. These connections are processed by the solve_shadows() function.
Template Parameters
TPrimaryCoordinatesa set of primary space coordinates, TPrimaryCoordinatesAnchor
TSampleSinka sample sink, specifying what to do with each generated path sample, see SampleSinkAnchor
TBPTContexta bidirectional path tracing context class, see BPTContextBase
TBPTConfiga policy class controlling the behaviour of the path sampling process, see BPTConfigBase

◆ sample_light_subpaths()

template<typename TPrimaryCoordinates , typename TBPTContext , typename TBPTConfig >
void bpt::sample_light_subpaths ( const uint32  n_light_paths,
TPrimaryCoordinates  primary_coords,
TBPTContext &  context,
const TBPTConfig &  config,
RenderingContext renderer,
RenderingContextView renderer_view 
)
A host function dispatching a series of kernels to sample a given number of light subpaths. The generated subpaths are controlled by a user-defined set of primary space coordinates. Specifically, this function executes a pipeline comprised of the following kernels:
  • generate_primary_light_vertices()
  • RTContext::trace()
  • process_secondary_light_vertices()
A templated policy config class specifies what to do with the generated light vertices.
Template Parameters
TPrimaryCoordinatesa set of primary space coordinates, TPrimaryCoordinatesAnchor
TBPTContexta bidirectional path tracing context class, see BPTContextBase
TBPTConfiga policy class controlling the behaviour of the path sampling process, see BPTConfigBase

◆ sample_paths()

template<typename TEyePrimaryCoordinates , typename TLightPrimaryCoordinates , typename TSampleSink , typename TBPTContext , typename TBPTConfig >
void bpt::sample_paths ( const uint32  n_eye_paths,
const uint32  n_light_paths,
TEyePrimaryCoordinates  eye_primary_coords,
TLightPrimaryCoordinates  light_primary_coords,
TSampleSink  sample_sink,
TBPTContext &  context,
const TBPTConfig &  config,
RenderingContext renderer,
RenderingContextView renderer_view,
const bool  lazy_shadows = false 
)
A host function dispatching a series of kernels to sample a given number of full paths. The generated paths are controlled by two user-defined sets of primary space coordinates, one for eye and light subpaths sampling. Specifically, this function executes the following two functions:
Template Parameters
TEyePrimaryCoordinatesa set of primary space coordinates, TPrimaryCoordinatesAnchor
TLightPrimaryCoordinatesa set of primary space coordinates, TPrimaryCoordinatesAnchor
TSampleSinka sample sink, specifying what to do with each generated path sample, see SampleSinkAnchor
TBPTContexta bidirectional path tracing context class, see BPTContextBase
TBPTConfiga policy class controlling the behaviour of the path sampling process, see BPTConfigBase

◆ solve_shadows()

template<typename TSampleSink , typename TBPTContext >
void bpt::solve_shadows ( TSampleSink  sample_sink,
TBPTContext &  context,
RenderingContext renderer,
RenderingContextView renderer_view 
)
A host function dispatching a series of kernels to resolve shadows / occlusion of the queued bidirectional connection samples generated by the sample_eye_subpaths function.
Template Parameters
TSampleSinka sample sink, specifying what to do with each generated path sample, see SampleSinkAnchor
TBPTContexta bidirectional path tracing context class, see BPTContextBase

Variable Documentation

◆ config

__global__ const uint32 const uint32 TSampleSink TPrimaryCoordinates TBPTContext RenderingContextView const TBPTConfig bpt::config
Initial value:
{
const uint32 thread_id = threadIdx.x + blockIdx.x * blockDim.x