Photon Engine 2.0.0-beta
A physically based renderer.
|
Trowbridge-Reitz distribution (GGX). See the original paper by Trowbridge et al. [16]. The paper "Microfacet Models for Refraction through Rough Surfaces" by Walter et al. [18] provides a nice explanation, too. More...
#include <TrowbridgeReitz.h>
Public Member Functions | |
TrowbridgeReitz (EMaskingShadowing maskingShadowingType) | |
std::array< real, 2 > | getAlphas (const SurfaceHit &X) const override=0 |
real | lambda (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H, const math::Vector3R &unitDir, const std::array< real, 2 > &alphas) const override=0 |
The \( \Lambda \left( a \right) \) function that appears in the masking-shadowing term. For isotropic distributions, the variable \( a \) is normally calculated as \( a = \frac{1}{\alpha \tan \left( \theta \right)} \), where \( \frac{1}{\tan \left( \theta \right)} \) is the slope of the unit direction unitDir (with respect to the macrosurface normal N . For anisotropic distributions, see the implementation of AnisoTrowbridgeReitz as an example for calculating \( a \) from the parameters. | |
real | distribution (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H) const override=0 |
Distribution of the microfacet normal. The \( D \) term. Also commonly knwon as the NDF (normal distribution function). This term is defined in the half-angle/microfacet space (the angle between N and H ) unless otherwise noted. | |
void | sampleH (const SurfaceHit &X, const math::Vector3R &N, const std::array< real, 2 > &sample, math::Vector3R *out_H) const override=0 |
Generate a microfacet normal H for the distribution. This samples all possible H vectors for the distribution. | |
void | sampleVisibleH (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &V, const std::array< real, 2 > &sample, math::Vector3R *out_H) const override |
Same as sampleH() , but tries to take geometry term into consideration. This samples only potentially visible H vectors for the distribution. If unable to fully or partly incorporate visibility information from the geometry term, this method will fallback to sampleH() . | |
lta::PDF | pdfSampleVisibleH (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H, const math::Vector3R &V) const override |
Public Member Functions inherited from ph::ShapeInvariantMicrofacet | |
ShapeInvariantMicrofacet (EMaskingShadowing maskingShadowingType) | |
real | geometry (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H, const math::Vector3R &L, const math::Vector3R &V) const override |
Masking and shadowing due to nearby microfacets. The \( G \) term. | |
lta::PDF | pdfSampleH (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H) const override |
Public Member Functions inherited from ph::Microfacet | |
virtual | ~Microfacet ()=default |
Additional Inherited Members | |
Protected Member Functions inherited from ph::ShapeInvariantMicrofacet | |
real | smithG1 (real lambdaValue) const |
real | empiricalPhiCorrelation (const SurfaceHit &X, const math::Vector3R &L, const math::Vector3R &V) const |
real | projectedDistribution (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H) const |
real | visibleDistribution (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H, const math::Vector3R &V) const |
Static Protected Member Functions inherited from ph::Microfacet | |
static bool | isSidednessAgreed (real NoD, real HoD) |
static bool | isSidednessAgreed (real NoL, real NoV, real HoL, real HoV) |
Protected Attributes inherited from ph::ShapeInvariantMicrofacet | |
EMaskingShadowing | m_maskingShadowingType |
Trowbridge-Reitz distribution (GGX). See the original paper by Trowbridge et al. [16]. The paper "Microfacet Models for Refraction through Rough Surfaces" by Walter et al. [18] provides a nice explanation, too.
|
explicit |
|
overridepure virtual |
Distribution of the microfacet normal. The \( D \) term. Also commonly knwon as the NDF (normal distribution function). This term is defined in the half-angle/microfacet space (the angle between N
and H
) unless otherwise noted.
H | The microfacet normal. |
Implements ph::ShapeInvariantMicrofacet.
Implemented in ph::AnisoTrowbridgeReitz, and ph::IsoTrowbridgeReitz.
|
overridepure virtual |
Implements ph::ShapeInvariantMicrofacet.
Implemented in ph::AnisoTrowbridgeReitz, ph::IsoTrowbridgeReitz, ph::IsoTrowbridgeReitzConstant, and ph::IsoTrowbridgeReitzTextured.
|
overridepure virtual |
The \( \Lambda \left( a \right) \) function that appears in the masking-shadowing term. For isotropic distributions, the variable \( a \) is normally calculated as \( a = \frac{1}{\alpha \tan \left( \theta \right)} \), where \( \frac{1}{\tan \left( \theta \right)} \) is the slope of the unit direction unitDir
(with respect to the macrosurface normal N
. For anisotropic distributions, see the implementation of AnisoTrowbridgeReitz
as an example for calculating \( a \) from the parameters.
Implements ph::ShapeInvariantMicrofacet.
Implemented in ph::AnisoTrowbridgeReitz, and ph::IsoTrowbridgeReitz.
|
overridevirtual |
H
using sampleVisibleH()
. Reimplemented from ph::Microfacet.
|
overridepure virtual |
Generate a microfacet normal H
for the distribution. This samples all possible H
vectors for the distribution.
out_H | The generated microfacet normal. |
pdfSampleH()
for the probability density of sampling the generated H
. distribution()
is not a probability density of microfacet normal. Implements ph::ShapeInvariantMicrofacet.
Implemented in ph::AnisoTrowbridgeReitz, and ph::IsoTrowbridgeReitz.
|
overridevirtual |
Same as sampleH()
, but tries to take geometry term into consideration. This samples only potentially visible H
vectors for the distribution. If unable to fully or partly incorporate visibility information from the geometry term, this method will fallback to sampleH()
.
Reimplemented from ph::Microfacet.