Fermat
Classes | Macros | Enumerations | Functions
BSDF

Detailed Description

This module defines the Bidirectional Scattering Distribution Function employed throughout Fermat. At present time, this model is rather simple, and consists of four layered components only:
  • a diffuse reflection component
  • a diffuse transmission component
  • a glossy reflection component layered on top of the diffuse layer
  • a glossy transmission component layered on top of the diffuse layer
The diffuse model is purely Lambertian, while the glossy components are based on the GGX model with Smith's joint masking-shadowing function described in:

[Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"]

Classes

struct  Bsdf
 
struct  Edf
 
struct  cugar::BlendBsdf< TBsdf1, TBsdf2 >
 
struct  cugar::DifferentialGeometry
 
struct  cugar::GGXVCavityMicrofacetDistribution
 
struct  cugar::GGXBsdf
 
struct  cugar::GGXSmithMicrofacetDistribution
 
struct  cugar::GGXSmithBsdf
 
struct  cugar::LambertBsdf
 
struct  cugar::LambertEdf
 
struct  cugar::LambertTransBsdf
 
struct  cugar::LTCBsdf
 

Enumerations

enum  TransportType { kRadianceTransport = 0, kParticleTransport = 1 }
 
enum  cugar::SphericalMeasure { kSolidAngle = 0, kProjectedSolidAngle = 1 }
 

Functions

FERMAT_API void precompute_glossy_reflectance (const uint32 S, float *tables)
 
FERMAT_API void precompute_TIR_loss (const uint32 S, float *tables)
 
bool cugar::bsdf_test (uint32 test_index, const GGXSmithBsdf &bsdf)
 
bool cugar::bsdf_test ()
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Vector3f cugar::microfacet (const Vector3f V, const Vector3f L, const Vector3f N, const float inv_eta)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Vector3f cugar::vndf_microfacet (const Vector3f V, const Vector3f L, const Vector3f N, const float inv_eta)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float cugar::hvd_ggx_eval (const float2 &inv_alpha, const float nh, const float ht, const float hb)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float3 cugar::hvd_ggx_sample (const float2 &samples, const float inv_alpha)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float3 cugar::hvd_ggx_sample (const float2 &samples, const float2 &inv_alpha)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float2 cugar::hvd_ggx_invert (const float3 H, const float2 inv_alpha)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float3 cugar::vndf_ggx_smith_sample (const float2 samples, const float2 alpha, const Vector3f _V)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float2 cugar::vndf_ggx_smith_invert (const Vector3f _N, const float2 alpha, const Vector3f _V)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE uint32 cugar::clip_quad_to_horizon (cugar::Vector3f L[5])
 
template<typename VectorType >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE VectorType cugar::fresnel_dielectric (const float cos_theta_i, const float cos_theta_t, const VectorType eta)
 
template<typename VectorType >
CUGAR_HOST_DEVICE CUGAR_FORCEINLINE VectorType cugar::fresnel_dielectric_conductor (const float cos_theta, const VectorType eta, const VectorType eta_k)
 
CUGAR_HOST_DEVICE CUGAR_FORCEINLINE float cugar::pow5 (const float x)
 
template<typename VectorType >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE VectorType cugar::fresnel_schlick (float cos_theta_i, const float eta, const VectorType fresnel_base)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE bool cugar::refraction_angle (const Vector3f w_i, const Vector3f N, const float eta, const float cos_theta_i, float *cos_theta_t)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE bool cugar::refract (const Vector3f w_i, const Vector3f N, const float cos_theta_i, const float eta, Vector3f *out, float *F)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Vector3f cugar::refract (const Vector3f w_i, const Vector3f N, const float eta, const float cos_theta_i, const float cos_theta_t)
 

Enumeration Type Documentation

◆ SphericalMeasure

Spherical measure type

◆ TransportType

transport type: defines whether we are tracing rays, or particles, i.e. whether the quantity being transported is radiance or power.

Function Documentation

◆ bsdf_test()

bool cugar::bsdf_test ( )
inline

unit test

◆ clip_quad_to_horizon()

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE uint32 cugar::clip_quad_to_horizon ( cugar::Vector3f  L[5])

clip a quad to the plane z = 0

◆ fresnel_dielectric()

template<typename VectorType >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE VectorType cugar::fresnel_dielectric ( const float  cos_theta_i,
const float  cos_theta_t,
const VectorType  eta 
)
Evaluate the Fresnel reflection coefficient for dielectrics

◆ fresnel_dielectric_conductor()

template<typename VectorType >
CUGAR_HOST_DEVICE CUGAR_FORCEINLINE VectorType cugar::fresnel_dielectric_conductor ( const float  cos_theta,
const VectorType  eta,
const VectorType  eta_k 
)
Evaluate the Fresnel reflection coefficient for dielectric/conductor interfaces

◆ fresnel_schlick()

template<typename VectorType >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE VectorType cugar::fresnel_schlick ( float  cos_theta_i,
const float  eta,
const VectorType  fresnel_base 
)
Evaluate the Fresnel reflection coefficient using Schlick's approximation
Parameters
etaincoming IOR / outgoing IOR

◆ hvd_ggx_eval()

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float cugar::hvd_ggx_eval ( const float2 &  inv_alpha,
const float  nh,
const float  ht,
const float  hb 
)

evaluate anisotropic GGX / Trowbridge-Reitz distribution on the non-projected hemisphere

[Walter et al. 2007, "Microfacet models for refraction through rough surfaces"]

nh

◆ hvd_ggx_invert()

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float2 cugar::hvd_ggx_invert ( const float3  H,
const float2  inv_alpha 
)

invert the the half-vector anisotropic GGX distribution sampling function

◆ hvd_ggx_sample() [1/2]

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float3 cugar::hvd_ggx_sample ( const float2 &  samples,
const float  inv_alpha 
)

sample isotropic GGX distribution on the non-projected hemisphere

◆ hvd_ggx_sample() [2/2]

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float3 cugar::hvd_ggx_sample ( const float2 &  samples,
const float2 &  inv_alpha 
)

sample the half-vector anisotropic GGX distribution on the non-projected hemisphere

◆ microfacet()

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Vector3f cugar::microfacet ( const Vector3f  V,
const Vector3f  L,
const Vector3f  N,
const float  inv_eta 
)

return the microfacet normal for a given pair of incident and outgoing direction vectors

◆ refract() [1/2]

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE bool cugar::refract ( const Vector3f  w_i,
const Vector3f  N,
const float  cos_theta_i,
const float  eta,
Vector3f out,
float *  F 
)
Evaluate refraction; this function returns false upon Total Internal Reflection (TIR).

◆ refract() [2/2]

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Vector3f cugar::refract ( const Vector3f  w_i,
const Vector3f  N,
const float  eta,
const float  cos_theta_i,
const float  cos_theta_t 
)
Evaluate refraction given the incident and transmitted angles with the normal

◆ refraction_angle()

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE bool cugar::refraction_angle ( const Vector3f  w_i,
const Vector3f  N,
const float  eta,
const float  cos_theta_i,
float *  cos_theta_t 
)
Evaluate the cosine of the refraction angle with the normal - cos(theta_t)

◆ vndf_ggx_smith_invert()

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float2 cugar::vndf_ggx_smith_invert ( const Vector3f  _N,
const float2  alpha,
const Vector3f  _V 
)

Inversion function for "A Simpler and Exact Sampling Routine for the GGX Distribution of Visible Normals" https://hal.archives-ouvertes.fr/hal-01509746

◆ vndf_ggx_smith_sample()

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float3 cugar::vndf_ggx_smith_sample ( const float2  samples,
const float2  alpha,
const Vector3f  _V 
)

A Simpler and Exact Sampling Routine for the GGX Distribution of Visible Normals https://hal.archives-ouvertes.fr/hal-01509746

◆ vndf_microfacet()

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Vector3f cugar::vndf_microfacet ( const Vector3f  V,
const Vector3f  L,
const Vector3f  N,
const float  inv_eta 
)

return the microfacet normal for a given pair of incident and outgoing direction vectors