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>
|
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 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) |
|
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.
◆ MaterialGGX()
MaterialGGX::MaterialGGX |
( |
| ) |
|
|
delete |
◆ alphaFromRoughness()
float MaterialGGX::alphaFromRoughness |
( |
float |
roughness | ) |
|
|
staticprivate |
Convert linear roughness to perceptual.
- Parameters
-
roughness | the linear roughness |
- Returns
- the perceptual roughness
◆ D()
float MaterialGGX::D |
( |
float |
NdotH, |
|
|
float |
alpha |
|
) |
| |
|
staticprivate |
Evaluate the normal distribution term.
- Parameters
-
NdotH | cosine of the angle between the surface normal and the (view,light) half vector |
alpha | the 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
-
wo | the outgoing ray direction (usually direction towards the camera) |
baseColor | the surface albedo (for dieletrics) or specular tint (for conductors) |
roughness | the linear roughness of the surface |
metallic | the metallicness of the surface (usually 0 or 1) |
wi | the 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
-
F0 | Fresnel coefficient at normal incidence |
VdotH | cosine 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
-
wo | the outgoing ray direction (usually direction towards the camera) |
baseColor | the surface albedo (for dieletrics) or specular tint (for conductors) |
alpha | the perceptual roughness of the surface |
metallic | the metallicness of the surface (usually 0 or 1) |
wi | the incoming ray direction (usually direction towards a light/surface) |
pdf | if 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
-
wo | the outgoing ray direction (usually direction towards the camera) |
baseColor | the surface albedo (for dieletrics) or specular tint (for conductors) |
roughness | the linear roughness of the surface |
metallic | the metallicness of the surface (usually 0 or 1). |
wi | will 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
-
NdotL | cosine of the angle between the view direction and the light direction |
NdotV | cosine of the angle between the surface normal and the view direction |
alpha | the surface perceptual roughness |
- Returns
- the intensity based on inter-shadowing of the microfacets.
The documentation for this class was generated from the following files: