By "Equation (11.8)" of Real-Time Rendering
Fourth Edition, the ambient occlusion can be calculated as kA(p)=∫H2(n)V(p,ωi)π1(cosθi)+dωi where V(p,ωi) is the visibility function and π1(cosθi)+ is the normalized clamped cosine.
1. Monte Carlo Integration
By AOIntegrator::Li in
PBRT-V3 and AOIntegrator::Li in
PBRT-V4, the Monte Carlo method can be used to integrate the ambient occlusion.
1-1. PDF
Since ∫H2(n)π1(cosθi)+dωi=1, the normalized clamped cosine π1(cosθi)+ can be used as the PDF.
1-2. Estimator
By "Equation (13.3)" of PBR Book V3 and
"Equation (2.7)" of PBR
Book V4, we have the Monte Carlo estimator kA(p)=∫H2(n)V(p,ωi)π1(cosθi)+dωi=∑N1π1(cosθi)+V(p,ωi)π1(cosθi)+=∑N1V(p,ωi).
1-3. Sampling Normalized Clamped Cosine
By "13.6.3 Cosine-Weighted Hemisphere Sampling" of PBR
Book V3 and "A.5.3 Cosine-Weighted Hemisphere Sampling" of PBR
Book V4, we can efficiently sample the normalized clamped cosine.
By "20.3 Quasirandom Low-Discrepancy Sequences" of [Colbert 2007], "13.8.2 Quasi Monte
Carlo" of PBR
Book V3 and "8.2.2 Low Discrepancy and Quasi Monte Carlo" of PBR
Book V4, the low discrepancy sequence is the better alternative than pseudo
random sequence to generate the ξ1 and ξ2.
By "7.4.1 Hammersley and Halton Sequences" of PBR
Book V3 and "8.6.1 Hammersley and Halton Points" of PBR
Book V4, the Hammersley sequence is a typical low-discrepancy
sequence.
By "11.3.2 Visibility and Obscurance" of Real-Time Rendering Fourth Edition, the visibility function
V(p,ωi) is actually the distance mapping function.
The value of the visibility function is 1 instead of 0, when closest intersection distance is greater than a
specified max distance.
2-2. Self Intersection
By [Wachter 2019], "3.9.5 Robust Spawned Ray Origins" of PBR Book V3
and "6.8.6 Robust Spawned Ray Origins" of PBR Book V4, we
should offset the ray origin to avoid self intersection.