Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::Microfacet Class Referenceabstract

#include <Microfacet.h>

Inheritance diagram for ph::Microfacet:
ph::ShapeInvariantMicrofacet ph::IsoBeckmann ph::TrowbridgeReitz ph::AnisoTrowbridgeReitz ph::IsoTrowbridgeReitz ph::IsoTrowbridgeReitzConstant ph::IsoTrowbridgeReitzTextured

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~Microfacet()

virtual ph::Microfacet::~Microfacet ( )
virtualdefault

Member Function Documentation

◆ distribution()

virtual real ph::Microfacet::distribution ( const SurfaceHit & X,
const math::Vector3R & N,
const math::Vector3R & H ) const
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.

Parameters
HThe microfacet normal.
Remarks
Do not treat this term as the probability density of microfacet normal over solid angle.

Implemented in ph::AnisoTrowbridgeReitz, ph::IsoBeckmann, ph::IsoTrowbridgeReitz, ph::ShapeInvariantMicrofacet, and ph::TrowbridgeReitz.

◆ geometry()

virtual real ph::Microfacet::geometry ( const SurfaceHit & X,
const math::Vector3R & N,
const math::Vector3R & H,
const math::Vector3R & L,
const math::Vector3R & V ) const
pure virtual

Masking and shadowing due to nearby microfacets. The \( G \) term.

Implemented in ph::ShapeInvariantMicrofacet.

◆ isSidednessAgreed() [1/2]

bool ph::Microfacet::isSidednessAgreed ( real NoD,
real HoD )
inlinestaticprotected
Parameters
NoDDot of the macrosurface normal N and a unit direction D.
HoDDot of the microsurface normal H and a unit direction D.
Returns
Checks the condition that the back surface of the microsurface is never visible from directions (such as 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).

◆ isSidednessAgreed() [2/2]

bool ph::Microfacet::isSidednessAgreed ( real NoL,
real NoV,
real HoL,
real HoV )
inlinestaticprotected

Same as isSidednessAgreed(2), but checks for both incident direction L and outgoing direction V.

◆ pdfSampleH()

virtual lta::PDF ph::Microfacet::pdfSampleH ( const SurfaceHit & X,
const math::Vector3R & N,
const math::Vector3R & H ) const
pure virtual
Returns
PDF of generating the specific microfacet normal H using sampleH().

Implemented in ph::ShapeInvariantMicrofacet.

◆ pdfSampleVisibleH()

lta::PDF ph::Microfacet::pdfSampleVisibleH ( const SurfaceHit & X,
const math::Vector3R & N,
const math::Vector3R & H,
const math::Vector3R & V ) const
inlinevirtual
Returns
PDF of generating the specific microfacet normal H using sampleVisibleH().

Reimplemented in ph::TrowbridgeReitz.

◆ sampleH()

virtual void ph::Microfacet::sampleH ( const SurfaceHit & X,
const math::Vector3R & N,
const std::array< real, 2 > & sample,
math::Vector3R * out_H ) const
pure virtual

Generate a microfacet normal H for the distribution. This samples all possible H vectors for the distribution.

Parameters
out_HThe generated microfacet normal.
Remarks
Use 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.

◆ sampleVisibleH()

void ph::Microfacet::sampleVisibleH ( const SurfaceHit & X,
const math::Vector3R & N,
const math::Vector3R & V,
const std::array< real, 2 > & sample,
math::Vector3R * out_H ) const
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.


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