Photon Engine 2.0.0-beta
A physically based renderer.
|
#include <Microfacet.h>
Public Member Functions | |
virtual | ~Microfacet ()=default |
virtual real | distribution (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H) const =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. | |
virtual real | geometry (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H, const math::Vector3R &L, const math::Vector3R &V) const =0 |
Masking and shadowing due to nearby microfacets. The \( G \) term. | |
virtual void | sampleH (const SurfaceHit &X, const math::Vector3R &N, const std::array< real, 2 > &sample, math::Vector3R *out_H) const =0 |
Generate a microfacet normal H for the distribution. This samples all possible H vectors for the distribution. | |
virtual lta::PDF | pdfSampleH (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H) const =0 |
virtual void | sampleVisibleH (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &V, const std::array< real, 2 > &sample, math::Vector3R *out_H) const |
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() . | |
virtual lta::PDF | pdfSampleVisibleH (const SurfaceHit &X, const math::Vector3R &N, const math::Vector3R &H, const math::Vector3R &V) const |
Static Protected Member Functions | |
static bool | isSidednessAgreed (real NoD, real HoD) |
static bool | isSidednessAgreed (real NoL, real NoV, real HoL, real HoV) |
Encapsulates a microfacet distribution along with its properties and common routines.
Regarding the microfacet normal, it is denoted as H
(for half vector) throughout the implementation. H
is expected to be on the hemisphere of N
, though a small error (slightly out-of-hemisphere) can exist. As N
, H
is expected to be normalized.
|
virtualdefault |
|
pure 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. |
Implemented in ph::AnisoTrowbridgeReitz, ph::IsoBeckmann, ph::IsoTrowbridgeReitz, ph::ShapeInvariantMicrofacet, and ph::TrowbridgeReitz.
|
pure virtual |
Masking and shadowing due to nearby microfacets. The \( G \) term.
Implemented in ph::ShapeInvariantMicrofacet.
|
inlinestaticprotected |
NoD | Dot of the macrosurface normal N and a unit direction D . |
HoD | Dot of the microsurface normal H and a unit direction D . |
D
) on the front side of the macrosurface and vice versa (sidedness agreement). This is a slightly modified version from the paper by Walter et al. [18], and is somewhat stricter when applied on an opaque surface (due to the additional requirement on the relation with macrosurface normal).
|
inlinestaticprotected |
Same as isSidednessAgreed(2)
, but checks for both incident direction L
and outgoing direction V
.
|
pure virtual |
H
using sampleH()
. Implemented in ph::ShapeInvariantMicrofacet.
|
inlinevirtual |
H
using sampleVisibleH()
. Reimplemented in ph::TrowbridgeReitz.
|
pure 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. Implemented in ph::AnisoTrowbridgeReitz, ph::IsoBeckmann, ph::IsoTrowbridgeReitz, ph::ShapeInvariantMicrofacet, and ph::TrowbridgeReitz.
|
inlinevirtual |
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 in ph::TrowbridgeReitz.