Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
MaterialGGX Class Reference

CPU methods for evaluating the Cook-Torrance BRDF (Lambert+GGX/Towbridge-Reitz) for a given set of parameters, and sample a ray following the distribution of normals. More...

#include <MaterialGGX.hpp>

Public Member Functions

 MaterialGGX ()=delete
 

Static Public Member Functions

static glm::vec3 sampleAndEval (const glm::vec3 &wo, const glm::vec3 &baseColor, float roughness, float metallic, glm::vec3 &wi)
 
static glm::vec3 eval (const glm::vec3 &wo, const glm::vec3 &baseColor, float roughness, float metallic, const glm::vec3 &wi)
 

Static Private Member Functions

static glm::vec3 F (glm::vec3 F0, float VdotH)
 
static float D (float NdotH, float alpha)
 
static float V (float NdotL, float NdotV, float alpha)
 
static float alphaFromRoughness (float roughness)
 
static glm::vec3 GGX (const glm::vec3 &wo, const glm::vec3 &baseColor, float alpha, float metallic, const glm::vec3 &wi, float *pdf)
 

Detailed Description

CPU methods for evaluating the Cook-Torrance BRDF (Lambert+GGX/Towbridge-Reitz) for a given set of parameters, and sample a ray following the distribution of normals.

Constructor & Destructor Documentation

◆ MaterialGGX()

MaterialGGX::MaterialGGX ( )
delete

Constructor. (deleted)

Member Function Documentation

◆ alphaFromRoughness()

float MaterialGGX::alphaFromRoughness ( float  roughness)
staticprivate

Convert linear roughness to perceptual.

Parameters
roughnessthe linear roughness
Returns
the perceptual roughness

◆ D()

float MaterialGGX::D ( float  NdotH,
float  alpha 
)
staticprivate

Evaluate the normal distribution term.

Parameters
NdotHcosine of the angle between the surface normal and the (view,light) half vector
alphathe surface perceptual roughness
Returns
the intensity based on the microfacets orientation.

◆ eval()

glm::vec3 MaterialGGX::eval ( const glm::vec3 &  wo,
const glm::vec3 &  baseColor,
float  roughness,
float  metallic,
const glm::vec3 &  wi 
)
static

Evaluate the BRDF value for a given set of directions and parameters. Both directions are expressed in the local frame and have the surface point as origin.

Parameters
wothe outgoing ray direction (usually direction towards the camera)
baseColorthe surface albedo (for dieletrics) or specular tint (for conductors)
roughnessthe linear roughness of the surface
metallicthe metallicness of the surface (usually 0 or 1)
withe incoming ray direction (usually direction towards a light/surface)
Returns
the BRDF evaluated for the sampled direction.

◆ F()

glm::vec3 MaterialGGX::F ( glm::vec3  F0,
float  VdotH 
)
staticprivate

Schlick-Fresnel approximation.

Parameters
F0Fresnel coefficient at normal incidence
VdotHcosine of the angle between the view direction and the (view,light) half vector
Returns
the Fresnel coefficient at the given view incidence.

◆ GGX()

glm::vec3 MaterialGGX::GGX ( const glm::vec3 &  wo,
const glm::vec3 &  baseColor,
float  alpha,
float  metallic,
const glm::vec3 &  wi,
float *  pdf 
)
staticprivate

Evaluate the specular GGX lobe BRDF.

Parameters
wothe outgoing ray direction (usually direction towards the camera)
baseColorthe surface albedo (for dieletrics) or specular tint (for conductors)
alphathe perceptual roughness of the surface
metallicthe metallicness of the surface (usually 0 or 1)
withe incoming ray direction (usually direction towards a light/surface)
pdfif non null, will contain the PDF of the incoming direction
Returns
the BRDF evaluated for the sampled direction.

◆ sampleAndEval()

glm::vec3 MaterialGGX::sampleAndEval ( const glm::vec3 &  wo,
const glm::vec3 &  baseColor,
float  roughness,
float  metallic,
glm::vec3 &  wi 
)
static

Sample a random direction based on the shape of the BRDF diffuse and specular lobes. Both directions are expressed in the local frame and have the surface point as origin.

Parameters
wothe outgoing ray direction (usually direction towards the camera)
baseColorthe surface albedo (for dieletrics) or specular tint (for conductors)
roughnessthe linear roughness of the surface
metallicthe metallicness of the surface (usually 0 or 1).
wiwill contain the sampled incoming ray direction (usually direction towards a light/surface)
Returns
the BRDF evaluated for the sampled direction, weighted by its PDF

◆ V()

float MaterialGGX::V ( float  NdotL,
float  NdotV,
float  alpha 
)
staticprivate

Evaluate the visibility term.

Parameters
NdotLcosine of the angle between the view direction and the light direction
NdotVcosine of the angle between the surface normal and the view direction
alphathe surface perceptual roughness
Returns
the intensity based on inter-shadowing of the microfacets.

The documentation for this class was generated from the following files: