Journal

animated explainers · rendering · sampling

Importance Sampling: Phong Lobe vs Cosine

Frank Yin
· 5:23
Share

Same integral, two pdfs, one N. Cosine fireflies the crescent; Phong starves the surround.

Animated explainer: why the way you aim rays decides where the noise goes

#graphics #engine #lighting

Appendix / Measurements full write-up, figures and tables

Prior analyses centered on temporal correspondence mechanisms: color clamping restricts invalid historical integration, whereas depth rejection determines surface occlusion validity. Timing and execution constraints are explicitly out of scope for the current analysis. While split-sum approximations conventionally abstract integration into a prefiltered environment map multiplied by a directional-albedo look-up table (DFG LUT)—facilitating high-performance real-time composition—this exposition isolates the fundamental Monte Carlo estimator. Tone mapping protocols remain consistent with prior pipelines, evaluating the Khronos PBR Neutral operator subsequent to the numerical resolve phase without per-scene parameter refitting. This evaluation strictly isolates stochastic variance induced by Monte Carlo sampling distribution mismatch. It does not encompass visible normal distribution functions (VNDF), multiple importance sampling (MIS) heuristics, or split-sum derivation.

Invariant Integral, Divergent Distributions, Fixed NN. Sampling proportional to the projected solid angle (cosine-weighted hemisphere) constitutes the analytically optimal distribution for Lambertian reflection. Conversely, generating samples proportional to a cosine-power (Phong) distribution localized about the specular reflection vector R=reflect(−ωo,n)R=\mathrm{reflect}(-\omega_o,n) maximizes efficiency for highly directional highlights. Evaluating a sharp dielectric surface reveals that these fundamental probability density functions (PDFs) are mathematically non-interchangeable.

Gallery spotlight: lacquer dielectric sphere on a short dark-stone plinth, dark slate wall, recessed canvas, painted picture rail. Phong-IS, N=256, s=32. Khronos PBR Neutral. Felt wall sparkles — Lambert sampled by a Phong lobe. Photograph only — no RMSE.
Gallery spotlight: lacquer dielectric sphere on a short dark-stone plinth, dark slate wall, recessed canvas, painted picture rail. Phong-IS, N=256, s=32. Khronos PBR Neutral. Felt wall sparkles — Lambert sampled by a Phong lobe. Photograph only — no RMSE.

To empirically validate this variance disparity, we introduce a controlled radiometric test scene: the gallery spotlight. The test configuration comprises a highly specular lacquer dielectric sphere positioned upon a low-profile dark-stone plinth, framed against a low-albedo slate wall, a recessed canvas element, and a painted picture rail. The cover rendering illustrates the geometric configuration utilizing Phong importance sampling (Phong-IS) evaluated at a sample count N=256N=\mathbf{256} and a specular exponent s=32s=\mathbf{32}. Diagnostic overlays confirm: Khronos PBR Neutral, PHOTO-ONLY, Phong-IS N=256 s=32. Note that quantitative root-mean-square error (RMSEH\mathrm{RMSE}_H) cannot be extracted from this non-linear presentation. The image exhibits pronounced high-frequency noise ("sparkle") across the diffuse felt background—an artifact generated by evaluating a low-frequency Lambertian integral utilizing a high-frequency specular probability density (Failure B). A converged analytical reference frame is documented subsequently.

Teaching pin. Same view, same N=64, same seed stream. Uniform | cosine | Phong-IS. Only p differs. Wedge crop of the highlight crescent under each column. Photograph only.
Teaching pin. Same view, same N=64, same seed stream. Uniform | cosine | Phong-IS. Only p differs. Wedge crop of the highlight crescent under each column. Photograph only.

Pin this comparison. The spatial distribution of variance is isolated across three adjacent uniform geometric crops. Each column visualizes the identical camera projection, evaluated at fixed N=64N=\mathbf{64} and driven by a shared deterministic pseudorandom seed. The columns evaluate Uniform, cosine, and Phong-IS generation respectively. The sole variable isolating the performance delta is the active PDF pp. The diagnostic plate isolates the high-gradient crescent highlight beneath each condition.

Execution metrics were captured via Mesa 25.0.7 llvmpipe in linear Rec.709 color space, tonemapped using Khronos PBR Neutral with exposure coefficient e=1.00e=\mathbf{1.00}. Pseudorandom generation utilized seed 329363537. The primary directional source subtends an angular radius of 3.600°. Evaluated at N=64N=\mathbf{64} and s=32s=\mathbf{32}, the cosine distribution produces a high highlight error RMSEH\mathrm{RMSE}_H of 7.655620, whereas Phong-IS achieves significant variance reduction, falling to 1.999657 (satisfying the validation condition: Phong << cosine). Conversely, examining the low-frequency diffuse surround region (RMSES\mathrm{RMSE}_S) quantifies the systemic inefficiency of the specular PDF: the optimal cosine distribution evaluates to 0.140667, while Phong-IS degrades severely to 0.824834, demonstrating diffuse starvation under highly localized directional sampling. Measured outlier ("firefly") accumulation (threshold k=4k=\mathbf{4}) registers 21536 samples for cosine generation versus 1653 samples for Phong. Region-of-interest bounding coordinates evaluate as ROIH=(502,391,555,432)\mathrm{ROI}_H=(\mathbf{502},\mathbf{391},\mathbf{555},\mathbf{432}) and ROIS=(349,133,613,319)\mathrm{ROI}_S=(\mathbf{349},\mathbf{133},\mathbf{613},\mathbf{319}). The comprehensive analytic suite reports 24 pass / 0 fail.

Scene

One analytic light, one Lambert+Phong lobe, and one view on Mesa llvmpipe. The cover and teaching pins in the opening lock the highlight crescent and the surround; only the sampling pdf and the NN/ss ladders in Discussion vary. Dense RMSE tables live in the appendices.

Method

Why: the estimator, then the two pdfs

All evaluations are performed in a scene-referred linear Rec.709 color space. The integration domain is defined as Ω+={ω:n⋅ω>0}\Omega^+=\{\omega:n\cdot\omega>0\}. Samples falling below the local geometric horizon contribute 0 to the radiance estimate, yet they remain valid samples toward the total count NN. Consequently, the probability density function pp must not be renormalized after rejecting a horizon sample.

Same integral

Lo(ωo)=∫Ω+fr(ω,ωo) Li(ω) (n⋅ω) dω.L_o(\omega_o)=\int_{\Omega^+} f_r(\omega,\omega_o)\,L_i(\omega)\,(n\cdot\omega)\,d\omega.

Unbiased solid-angle estimator

L^o=1N∑k=1Nfr(ωk,ωo) Li(ωk) (n⋅ωk)p(ωk).\hat L_o=\frac1N\sum_{k=1}^N\frac{f_r(\omega_k,\omega_o)\,L_i(\omega_k)\,(n\cdot\omega_k)}{p(\omega_k)}.

Every sampling arm evaluates the identical frf_r, LiL_i, geometry, and camera model. The cosine term (n⋅ωk)(n\cdot\omega_k) remains explicitly in the numerator and is not pre-folded into the probability density pp.

BRDF (Lambert + Lafortune-normalized Phong)

fr(ω,ωo)=ρdπ+ρss+22π (ω⋅R)+ s,R=2(n⋅ωo) n−ωo.f_r(\omega,\omega_o)=\frac{\rho_d}{\pi}+\rho_s\frac{s+2}{2\pi}\,(\omega\cdot R)_+^{\,s}, \qquad R=2(n\cdot\omega_o)\,n-\omega_o.

We evaluate a dielectric material model rather than a pure metal. The base parameters are configured as diffuse albedo ρd=(0.155,0.175,0.188)\rho_d=(0.155, 0.175, 0.188), specular albedo ρs=0.12\rho_s=0.12, and specular exponent s=32s=32. Employing a purely metallic surface (ρd=0\rho_d=0) would artificially mask the diffuse sampling deficiencies characterized later as Failure B.

The coefficient (s+2)(s+2) acts as the BRDF energy normalization constant, whereas (s+1)(s+1) represents the solid-angle pdf constant. Conflating these terms introduces bias into L^\hat L. Under a white-furnace assertion (Li≡1L_i\equiv 1, with the specular lobe entirely above the horizon), we mathematically verify that L^o≈ρd+ρs\hat L_o\approx\rho_d+\rho_s within a prescribed tolerance. This establishes a rigorous baseline for the estimator prior to evaluation.

We omit Fresnel, GGX D/GD/G, and Smith shadowing-masking terms; this investigation isolates fundamental Monte Carlo sampling behaviors over a hemispherical lobe rather than evaluating specific microfacet product models.

Pdfs (1/sr)

Arm Name p(ω)p(\omega) Inverse CDF
C Uniform hemisphere 1/(2π)1/(2\pi) on Ω+\Omega^+ cos⁡θ=ξ1\cos\theta=\xi_1, φ=2πξ2\varphi=2\pi\xi_2, ONB around nn
A Cosine hemisphere (n⋅ω)/π(n\cdot\omega)/\pi on Ω+\Omega^+ cos⁡θ=ξ1\cos\theta=\sqrt{\xi_1}, φ=2πξ2\varphi=2\pi\xi_2, ONB around nn
B Phong lobe about RR (s+1)/(2π) (ω⋅R)s(s+1)/(2\pi)\,(\omega\cdot R)^s if ω⋅R>0\omega\cdot R>0, else 00 cos⁡θ=ξ11/(s+1)\cos\theta=\xi_1^{1/(s+1)}, φ=2πξ2\varphi=2\pi\xi_2, ONB around RR

Phong samples are generated within the local RR-frame. If the generated vector satisfies n⋅ω≤0n\cdot\omega\le 0, the corresponding sample weight evaluates to 0, and the internal horizon_frac counter increments. The random number generator relies on a PCG integer hash initialized with the deterministic seed 329363537.

Light (analytic; no HDRI)

The scene utilizes 1-bounce direct lighting. The primary illumination source is a finite disk key light positioned in the upper-front-right quadrant, subtending an angular radius of 3.600° from the highlight point (corresponding to diskr=0.1372\mathrm{disk}_r=0.1372). The key light radiance is designated as Lkey=(980,880,720)L_{\mathrm{key}}=(980, 880, 720). To ensure the geometric flanks and background walls remain well-posed for measurement, a uniform, dim cool fill light of Lfill=(1.20,1.38,1.62)L_{\mathrm{fill}}=(1.20, 1.38, 1.62) is applied across Ω+\Omega^+.

The incident radiance Li(ω)L_i(\omega) equals LkeyL_{\mathrm{key}} if the sampled ray intersects the disk unoccluded by the primary sphere or plinth; otherwise, it evaluates to LfillL_{\mathrm{fill}}. This analysis exclusively targets the reflection pdf. We do not sample the light pdf, nor do we employ Multiple Importance Sampling (MIS). Furthermore, employing a Dirac directional light would be mathematically unsound, as hemisphere Monte Carlo integration cannot sample a delta distribution without collapsing into strict Next Event Estimation (NEE). The intentionally restrictive solid angle of the key light demonstrates precisely why cosine sampling produces severe fireflies, exposing how a sufficiently sharp ss value can cause random generation to miss the high-energy target entirely.

Jacobian / solid angle

The inverse-CDF mapping transforms standard uniform variates (ξ1,ξ2)∈[0,1)2(\xi_1,\xi_2)\in[0,1)^2 into directional vectors ω∈S2\omega\in\mathbb{S}^2. The distributions pp formalized above are expressed directly in solid angle measure, requiring no additional dω/dξd\omega/d\xi transformations. In contrast, a half-vector sampling scheme would necessitate the h→ωh\to\omega Jacobian, ∂Ωh/∂Ωω=4(ω⋅h)\partial\Omega_h/\partial\Omega_\omega=4(\omega\cdot h). That transformation justifies a separate analysis for Blinn or GGX-VNDF models, which are cited here but explicitly not derived. While VNDF approaches represent the production standard for such lobes, they fall outside the strict parameters of this isolated A/B comparison.

Variance used on plates

Variance measurements are conducted strictly on scene-referred linear Rec.709 YY luminance values. Computations are performed intrinsically on the float buffer prior to Neutral tone mapping and are never approximated via compressed JPEG outputs.

RMSEROI=1∣ROI∣∑x∈ROI(Y(L^N(x))−Y(Lref(x)))2.\mathrm{RMSE}_{\mathrm{ROI}} =\sqrt{\frac1{\lvert\mathrm{ROI}\rvert}\sum_{x\in\mathrm{ROI}}\bigl(Y(\hat L_N(x))-Y(L_{\mathrm{ref}}(x))\bigr)^2}.

The analysis isolates two regions of interest (ROIs), specified as inclusive pixel coordinates at a baseline rendering resolution of 960×540960\times 540 (indexed bottom-up):

  • H — the specular highlight crescent illuminated by the key light: (502,391,555,432)(502, 391, 555, 432).
  • S — the diffuse geometric structures comprising the flank, plinth, and foot: (349,133,613,319)(349, 133, 613, 319).

Per-pixel variance of the mean (which operates independently of a ground truth reference) is formalized as:

Var^(x)=1N(N−1)∑k=1N(Xk(x)−Xˉ(x))2.\widehat{\mathrm{Var}}(x)=\frac1{N(N-1)}\sum_{k=1}^N\bigl(X_k(x)-\bar X(x)\bigr)^2.

The diagnostic heat plate maps the absolute residual ∣Y64−Yref∣\lvert Y_{64}-Y_{\mathrm{ref}}\rvert using a turbo colormap. These comparisons (cosine versus Phong) rely on the same highlight-rim crop and a shared p98 scale to maintain comparative rigor. The discrete firefly count is objectively quantified as #{x:∣YN−Yref∣>k Yref}\#\{x:\vert{}Y_N-Y_{\mathrm{ref}}\vert{}>k\,Y_{\mathrm{ref}}\} with k=4k=4, strictly constrained to geometry-hit pixels. Whole-frame RMSE is explicitly relegated to footnotes; aggregating regions H and S mathematically dilutes the distinct variance pathologies this analysis isolates.

Display (inherited, not re-derived)

Ldisplay=TM(expose(L^o))then IEC 61966-2-1 sRGB OETF for PNG.L_{\mathrm{display}} = \mathrm{TM}\bigl(\mathrm{expose}(\hat L_o)\bigr) \quad\text{then IEC 61966-2-1 sRGB OETF for PNG.}

The Tone Mapping (TM) operator is Khronos PBR Neutral, fixed at an exposure of e=1.00e=1.00, and remains strictly uniform across sampling arms A, B, and C. These display constants are deliberately not re-fit per iteration. For broader context, we direct the reader to the tone-mapping and split-sum IBL documentation. The GL_FRAMEBUFFER_SRGB state is explicitly disabled, forcing the OETF encode onto the CPU. We emphasize that all quantitative metrics evaluate the floating-point buffer directly, independent of the encoded output.

Reference (not a sampling arm)

The ground-truth reference LrefL_{\mathrm{ref}} aggregates an analytic Lambert integrated against the fill light, a Phong importance-sampled specular component against the fill (at 32 spp), and a highly optimized disk NEE component (at 96 spp). This composite estimator operates on the independent random seed 1374605335. Notably, the standard testing arms strictly avoid sampling the light pdf. This hybrid assembly yields a heavily converged, high-NN-quality reference image without computationally overwhelming the rasterizer backend with 4096 spp hemisphere Monte Carlo evaluations. The reference plate explicitly delineates ROI H and S visually, but serves purely as a measurement ground truth rather than an aesthetic cover image.


Science reference. Disk NEE plus analytic Lambert fill. ROI H (highlight crescent) and ROI S (flank / plinth / foot) outlined. Not a sampling arm. Not the cover.
Science reference. Disk NEE plus analytic Lambert fill. ROI H (highlight crescent) and ROI S (flank / plinth / foot) outlined. Not a sampling arm. Not the cover.

Two paths, do not mix the instruments

path frames instrument
Photograph hero, 3-up, NN ladders, exponent, surround CPU MC of reflection pdfs on this llvmpipe, Neutral e=1.00e=1.00, sRGB OETF. HUD photo-only.
Instrument variance heat, pdf rose, metrics strip, reference ∣YN−Yref∣\lvert Y_N-Y_{\mathrm{ref}}\rvert heat, pdf rose, RMSE / fireflies / horizon, NEE reference.
Display every plate expose e=1.00e=1.00 →\to Neutral →\to sRGB OETF. Resolve is linear. Operator is inherited.

The 3-up graphic serves dually as a photographic record of the control methodology and as the primary pedagogical mechanism. Quantitative analysis must rely exclusively on the reported numerical metrics for RMSE and firefly counts. Visual estimation from the 8-bit composite panel cannot substitute for the precise float-buffer metric of 7.655620.


Estimator lock

Lo   = (1/N) sum  f_r(w_k, w_o) * L_i(w_k) * (n·w_k) / p(w_k)
p_c  = (n·ω)/π                         // ONB around n
p_p  = (s+1)/(2π) (ω·R)^s              // ONB around R; n·ω≤0 → weight 0, still in N
f_r  = ρd/π + ρs (s+2)/(2π) (ω·R)_+^s  // s+1 is pdf; s+2 is BRDF
PNG  = sRGB_OETF( Neutral(e * Lo) )    // e=1.00, inherited

Locked fundamentals: we maintain the exact same integral, two varying pdfs, and a single NN. Cosine firmly remains in the numerator. Horizon weight correctly hits 0 while still counting in NN. The Neutral tone mapper is inherited exactly as-is, not re-fit. We pin the gallery still as the final visual presentation. We pin the 3-up as the core teaching mechanism. We pin the variance heat map as the distinct mathematical fingerprint. We pin the surround crop as our definitive honesty plate. These sampling tickets are simply not interchangeable.

Discussion

Two questions, two pdfs

The underlying radiometric integral is strictly preserved. Emissive geometry, receiver topology, virtual camera parameters, BRDF definition, exposure mapping, and the localized per-pixel uniform variate stream ξ\xi remain invariant. Only the directional probability density p(ω)p(\omega) is modified. The resultant variance delta dictates the convergence properties of the final image.

  • Cosine: Does the generated directional distribution correspond to the ideal Lambertian response scaled by the projected solid angle?

  • Phong-IS: Does the generated directional distribution correspond to the specular cosine-power profile localized symmetrically about the ideal reflection vector RR? (This specific evaluation excludes half-vector microfacet derivations, Blinn parameterizations, and GGX-VNDF mappings.)

Evaluating a sharp lacquer dielectric illuminated by a constrained 3.600° primary source reveals the inherent statistical mismatch between these distributions. Cosine sampling allocates minimal probability mass toward the localized specular event. When a generated sample successfully intersects the narrow key light domain, the evaluated incident radiance LiL_i dominates the integrand; however, the corresponding probability density pc=(n⋅ω)/πp_c=(n\cdot\omega)/\pi remains minimal, resulting in a disproportionately massive sample weight that manifests visually as a firefly artifact. Conversely, Phong-IS maps the inverse cumulative distribution function (CDF) directly over the reflection vector RR, efficiently accumulating probability mass within the highlight crescent. However, this highly localized distribution simultaneously starves the diffuse surround of sufficient sample density.

A uniform hemispherical distribution (p=1/(2π)p=\mathbf{1}/(\mathbf{2}\pi)) operates as a highly inefficient baseline: uniform angular density does not mathematically substitute for projected solid angle importance sampling. Evaluated at N=64N=\mathbf{64} and s=32s=\mathbf{32}, uniform sampling produces an RMSEH=9.900829\mathrm{RMSE}_H=\mathbf{9.900829}, exceeding cosine's 7.655620. The corresponding statistical variance (varH\mathrm{var}_H) evaluates to 90.04 versus 56.93 for cosine. Examining the firefly count across the identical analytical row yields 21536 for cosine, 14400 for uniform, and 1653 for Phong-IS. When quantifying estimator convergence, analytical RMSEH\mathrm{RMSE}_H supersedes qualitative firefly tallies.

The central analytical conclusion is fundamental: PDF–integrand divergence mathematically guarantees increased estimator variance, extending beyond subjective visual preference. Cosine generation optimally minimizes variance for the Lambertian response over the projected hemisphere, while Phong-IS optimally minimizes variance for the localized cosine-power highlight. Neither isolated analytical PDF can optimally sample both phenomena concurrently without adopting multiple importance sampling heuristics.

Quantitative analysis necessitates strict differentiation between radiometric modes:

  1. Photographic Plates (e.g., hero renders, multi-column comparisons, convergence sweeps, exponent evaluations, and localized crops) represent CPU-evaluated Monte Carlo integration buffers mapped through Khronos PBR Neutral and the standard 8-bit sRGB opto-electronic transfer function (OETF). The photo-only designation explicitly precludes extracting analytical RMSE, exact firefly geometries, or raw mean luminance Ymean\mathrm{Y_{mean}} from non-linear image encodings, as the Neutral mapping and sRGB compression structurally clip extreme statistical outliers.

  2. Analytical Instruments (e.g., variance differential heat maps, polar PDF roses, tabular metrics, and reference integration fields) operate directly upon the unclamped floating-point buffer. These structures accurately quantify linear Rec.709 YY residuals, geometric PDF distributions, true RMSE, statistical outlier frequencies, and geometric horizon limits. Analytical comparisons rely exclusively upon these uncompressed metrics.

Teaching pin: three pdfs, one view

The 3-up comparison establishes a baseline experimental control. Operating under strictly identical camera parameters, geometry, materials, lighting states, and exposure, we evaluate at N=64N=64 samples using the deterministic seed 329363537. The probability density function pp serves as the sole independent variable.

Column pdf p(ω)p(\omega) Empirical Consequence
Uniform 1/(2π)1/(2\pi) Severe global variance. Suppressed highlight crescent. Yields highest RMSEH\mathrm{RMSE}_H.
Cosine (n⋅ω)/π(n\cdot\omega)/\pi Stabilizes diffuse body responses. Specular highlight rim remains highly stochastic.
Phong-IS (s+1)/(2π) (ω⋅R)s(s+1)/(2\pi)\,(\omega\cdot R)^s Specular crescent rapidly converges. Diffuse surround regions exhibit severe undersampling.

If evaluating the full-frame renderings casualy suggests that Phong sampling is categorically superior, the diffuse surround actively refutes that hypothesis. We utilize the localized wedge crop to expose Failure A, and the secondary diffuse crop to demonstrate Failure B. Objective analysis requires referencing RMSEH\mathrm{RMSE}_H and RMSES\mathrm{RMSE}_S directly from the float-buffer metrics rather than visually estimating variance from an 8-bit panel.


Unique artifact: variance heat on the highlight rim

This spatial variance visualization represents the primary motivation for this analysis. The plate maps the false-color absolute residual ∣Y64−Yref∣\lvert Y_{64}-Y_{\mathrm{ref}}\rvert within the linear Rec.709 YY domain via the turbo colormap. It enforces the same highlight-rim crop and a shared p98 scale. The instrumentation HUD accurately reads: INSTRUMENT FINGERPRINT, linear Rec.709 Y residual not PNG.

Unique artifact. False-color |Y_64−Y_ref|, linear Rec.709 Y, turbo. Cosine vs Phong-IS, same highlight-rim crop, shared p98 scale. Heat leaves the rim under Phong. Instrument — not PNG.
Unique artifact. False-color |Y_64−Y_ref|, linear Rec.709 Y, turbo. Cosine vs Phong-IS, same highlight-rim crop, shared p98 scale. Heat leaves the rim under Phong. Instrument — not PNG.

Under cosine sampling, significant variance heat rings the highlight crescent, manifesting as a broad residual envelope populated with extreme-magnitude fireflies. When substituting Phong importance sampling, variance drops dramatically across the specular rim—shifting to a low-error state characterized by sparse, low-magnitude outliers. This spatial shift precisely maps the geometric domain that effectively received samples. As variance drops along the specular rim, it correspondingly intensifies across the diffuse flanks. This structural swap in the error domain serves as the definitive fingerprint of the respective sampling mismatch. This represents a fundamental Monte Carlo integration disparity, not a superficial RGB artifact or a post-process DFG LUT transformation.

The pdf rose visualization functions as a secondary scientific diagnostic. It projects the linear pdf in 1/sr over the hemisphere via the turbo colormap, directly comparing a cosine distribution about nn against a Phong distribution about the identical reflection vector RR, holding s=32s=32. Corresponding polar projections accompany the hemisphere plots. The documentation firmly stipulates that this is intrinsically not Blinn, nor is it a GGX VNDF parameterization. This geometric intuition supplements the empirical residuals and is intentionally reserved for scientific documentation rather than aesthetic cover display.

Instrument. Hemisphere overlay, linear pdf in 1/sr, turbo: cosine about n vs Phong about the same R, s=32. Polar insets under each. Not Blinn, not GGX VNDF.
Instrument. Hemisphere overlay, linear pdf in 1/sr, turbo: cosine about n vs Phong about the same R, s=32. Polar insets under each. Not Blinn, not GGX VNDF.

All diagnostic conclusions must remain rooted in numerical metrics rather than JPEG visual appearances.

Ladders: NN, then ss

Failure A. We evaluate cosine sampling at sample counts N∈{4,16,64,256}N \in \{4, 16, 64, 256\}, maintaining identical seed-stream prefixes. Fireflies decay remarkably slowly along the specular rim. By N=256N=256, the diffuse body stabilizes, but the crescent fails to resolve to a converged state. The RMSEH\mathrm{RMSE}_H progression across these four sample counts is: 27.886635, 15.989179, 7.655620, and 3.837384.

Failure A. Cosine at N=4 / 16 / 64 / 256, same seed-stream prefixes. Fireflies decay slowly on the rim. Photograph only.
Failure A. Cosine at N=4 / 16 / 64 / 256, same seed-stream prefixes. Fireflies decay slowly on the rim. Photograph only.

Contrast. Phong-IS at the same N rungs, matching pdf. Rim cleans earlier. Surround stays dark with sparkles. Photograph only.
Contrast. Phong-IS at the same N rungs, matching pdf. Rim cleans earlier. Surround stays dark with sparkles. Photograph only.

Exponent control. Phong-IS, fixed N=64, s=8 / 32 / 128, matching pdf. Wide ≈ cosine on H; sharp starves the s=32 crescent and S. Photograph only.
Exponent control. Phong-IS, fixed N=64, s=8 / 32 / 128, matching pdf. Wide ≈ cosine on H; sharp starves the s=32 crescent and S. Photograph only.

Contrast. Applying Phong importance sampling (Phong-IS) at the exact same NN intervals with a matching probability density function (pdf) yields a rim that converges significantly earlier. The crescent becomes structurally readable by N=16N=16 and tightens considerably at 64 and 256. Conversely, the surround remains pathologically dark and retains high-variance speckling, indicating that Failure B persists in tandem. The corresponding RMSEH\mathrm{RMSE}_H progression is: 8.377738, 4.037456, 1.999657, and 1.010789.

Exponent control. Isolating the Phong-IS estimator at a fixed N=64N=64, we evaluate specular exponents s∈{8,32,128}s \in \{8, 32, 128\} against their matching pdfs. A wide specular lobe behaves similarly to cosine sampling within region H; at s=8s=8, we observe an RMSEH=1.783442\mathrm{RMSE}_H=1.783442, which still outperforms the cosine baseline. The default parameter of s=32s=32 serves as the validated pass threshold. However, evaluating a sharp s=128s=128 lobe against this 3.600° key light produces an RMSEH=7.367447\mathrm{RMSE}_H=7.367447. Because region H strictly bounds the s=32s=32 crescent, increasing the exponent narrows the sampling distribution and starves the broader rim area. This confirms that exponent variance is an artifact of proper parametric control rather than a failure of the pass predicate. Furthermore, pushing ss to extreme values severely degrades the diffuse measurement in region S.

We strongly advise against retuning exposure or Neutral tone mapping to conceal cosine fireflies in a beauty render; the stochastic artifacts constitute the core empirical result, and the diagnostic heat plate accurately maps their distribution.


Failure B: Phong-IS starves the surround

This evaluation provides an unvarnished assessment via a tight crop of the flank, plinth, and foot geometries. Comparing the cosine estimator at N=64N=64 against Phong-IS at s=32s=32 and s=128s=128, the visual starvation artifact dictates the crop's convergence.

Honesty plate. Tight crop of flank / plinth / foot. Cosine N=64 | Phong-IS s=32 | Phong-IS s=128. Starve is allowed to win the crop. Photograph only — RMSE from float Y.
Honesty plate. Tight crop of flank / plinth / foot. Cosine N=64 | Phong-IS s=32 | Phong-IS s=128. Starve is allowed to win the crop. Photograph only — RMSE from float Y.

Quantitatively, at N=64N=64 and s=32s=32, the cosine RMSES\mathrm{RMSE}_S measures 0.140667, whereas the Phong-IS error increases to 0.824834. Increasing the specular exponent to s=128s=128 further exacerbates this to 0.860317. Both Phong-derived variances significantly exceed the cosine baseline. Because the pdf tightly concentrates sampling rays around the reflection vector RR, the underlying Lambertian BRDF component starves for samples across the remainder of the hemisphere Ω+\Omega^+. A high ss value fundamentally fails to integrate the incident radiance on the plinth.

This systematic starvation manifests in the global luminance averages: the Phong Ymean≈0.059\mathrm{Y_{mean}} \approx 0.059, compared to the cosine baseline of ≈0.146\approx 0.146 at N=64N=64. In the combined white furnace test (ρd+ρs\rho_d+\rho_s), the Phong estimator severely undershoots, yielding 0.1930 against the analytic expectation of 0.2917. At s=32s=32, the inverse-CDF mapping effectively fails to place the Lambertian tail into standard single-precision floating-point precision (the ξ=μs+1\xi=\mu^{s+1} operation underflows). Conversely, an isolated specular-only Phong furnace test accurately converges to ρs=0.1200\rho_s=0.1200, validating the mathematical distinction between the s+1s+1 and s+2s+2 normalization constants. The combined cosine estimator accurately reaches 0.2923 against the 0.2917 target. While Phong importance sampling remains theoretically unbiased, the floating-point implementation of the inverse-CDF functions poorly as a full-hemisphere Lambertian sampler at this specific ss configuration.

Notably, the Phong RMSES\mathrm{RMSE}_S does not decay monotonically with NN for this specific random seed: it measures 0.824834 at 64 samples but spikes to 1.754730 at 256 samples. This divergence stems from rare, high-leverage key light hits striking the plinth, representing residual variance rather than a novel convergence theorem.

The primary hero image relies on Phong-IS, explicitly preserving the sparkling artifacts on the felt wall to document this exact failure mode. The converged gallery photograph provides the actual ground-truth reference.

Production rendering architectures mitigate this compromise via Multiple Importance Sampling (MIS). We note this for completeness, though it serves as contextual methodology rather than an excuse to generate a flawed bake-off hero image.


What-if controls

Every evaluated A/B/C sampling plate enforces bit-identical camera parameters, scene geometry, material configurations, light emissions, exposure settings, and per-pixel uniform variate streams (ξ\xi). Only the inverse-CDF mapping diverges, strictly isolating the variation in generated sample directions. Crucially, a direction sampled via a cosine distribution must never be evaluated under a Phong pdf weight.

What if: Seed

We publish a singular deterministic integer seed: 329363537. This specific random stream governs all sampling arms. If a measured residual artifact completely inverts upon altering the seed, the phenomenon is statistically attributable to random noise (RNG variance) rather than demonstrating a persistent mathematical theorem.

What if: Horizon

Generated samples falling below the local geometric horizon are correctly assigned a weight of 0, yet they mathematically remain part of the sample denominator NN. We explicitly log this rejection rate as horizon_frac. We strictly prohibit pdf renormalization; renormalizing over the upper hemisphere artificially introduces bias into the estimator. Under Phong importance sampling at an exponent of s=32s=32, the recorded fraction is 0.025246. For the cosine and uniform estimators (which map identically within the strictly positive nn-frame), the fraction remains analytically 0. Expanding the specular lobe to s=8s=8 increases the rejection fraction to 0.084079, whereas constraining the lobe to a sharp s=128s=128 decreases it to 0.002089.

What if: White furnace

This diagnostic is evaluated under a uniform white illumination condition (Li=1L_i=1), ensuring the primary specular lobe is oriented safely above the horizon. The combined cosine estimator and the specular-only Phong estimator function as mandatory gated assertions. We note that the combined Phong estimator fails this test, undershooting the expected analytic limit; this arises entirely from precision underflow in the single-precision floating-point inverse-CDF tail, not from an artificially relaxed assertion band.

What if: Firefly kk

Firefly artifacts are strictly classified via a magnitude threshold of k=4k=4, evaluated against the linear YY luminance buffer. Firefly quantification must never occur on the final 8-bit JPEG, as the non-linear Khronos PBR Neutral operator and subsequent sRGB OETF effectively truncate and mask extreme variance outliers.

What if: Light angular size

The key light source is strictly parameterized with an angular radius of 3.600°. This specific solid angle is sufficiently small to induce severe sampling deficiencies (fireflies) under a standard cosine distribution, yet large enough that a Phong pdf parameterized at s=32s=32 successfully acquires it. Utilizing a theoretical Dirac delta light would fatally collapse the experiment into trivial Next Event Estimation (NEE). Conversely, deploying an excessively broad light source would artificially mask the cosine estimator's variance, nullifying the fundamental premise of this investigation.

What if: Material

The evaluated surface constitutes a dielectric material, guaranteeing that both the diffuse (ρd\rho_d) and specular (ρs\rho_s) BRDF components actively contribute to the integral. The background plinth, structural walls, and floor exhibit purely Lambertian behavior. Constraining the evaluation to a purely metallic model would erroneously conceal the diffuse surround starvation pathology identified as Failure B.

What if: ROI

Region of Interest (ROI) H strictly bounds the specular crescent illuminated by the key light. Conversely, ROI S bounds the diffuse flank and plinth, intentionally excluding any high-intensity highlight pixels. We reject whole-frame RMSE as an acceptable metric because it indiscriminately aggregates the fundamentally distinct variance behaviors of regions H and S.


Limits

Honesty gaps

  1. Offline spp strip on OSMesa / llvmpipe. This investigation conducts static offline evaluations using fixed sample counts (NN). It does not evaluate dynamic rendering at 60 Hz, nor does it represent an interactive 1 spp demonstration, hardware ray tracing (RT), or a production image-based lighting (IBL) baker.
  2. JPEG is 8-bit display-referred. The sequential application of the Neutral tone mapper and the sRGB OETF structurally clips stochastic fireflies. Consequently, rigorous evaluations of RMSE, variance, and discrete firefly counts are performed strictly on the linear YY component of the uncompressed float buffer.
  3. Hero is Phong-IS. The primary presentation render utilizes Phong-IS, deliberately preserving the visible high-variance speckling on the background felt wall. This artifact constitutes Failure B, proudly displayed rather than obscured by a denoiser. The mathematically clean still is appropriately relegated to the reference plate.
  4. LrefL_{\mathrm{ref}} uses disk NEE. The ground-truth reference incorporates disk Next Event Estimation (NEE). This specific integration strategy is strictly isolated from the standard A/B/C testing arms. The core experimental methodology evaluates reflection pdfs exclusively.
  5. Combined Phong white furnace undershoots. The combined Phong estimator yields an energy sum of 0.1930 against an analytic expectation of 0.2917. Operating at s=32s=32, the inverse-CDF mapping cannot accurately resolve the Lambertian tail within standard float32 precision. The isolated specular test exactly recovers ρs\rho_s, while the combined cosine test successfully integrates to ρd+ρs\rho_d+\rho_s.
  6. Phong RMSES\mathrm{RMSE}_S is not monotone in NN. Under this specific random seed, the Phong error metric for the diffuse surround fails to decay monotonically, yielding an RMSES\mathrm{RMSE}_S of 0.824834 at 64 samples, but sharply increasing to 1.754730 at 256 samples. This statistical anomaly derives from rare, high-leverage key light intersections striking the plinth. It represents localized residual heat, not the discovery of a novel integration theorem.
  7. s=128s=128 yields an RMSEH\mathrm{RMSE}_H of 7.367447. This metric serves as an exponent control evaluated against a 3.600° key light within the s=32s=32 optimized ROI H. It verifies parametric narrowing and is not indicative of a failed structural pass predicate.
  8. Beauty 960×540960\times 540. The internal rendering resolution is configured to 960×540960\times 540, subsequently scaled to fit within a 1280×7201280\times 720 bounding layout. The final composite plates are delivered at 1280×7201280\times 720. This analysis does not present full-frame 4k high-spp renders.
  9. Analytic sphere. The geometric normal nn is calculated directly from the implicit mathematical definition of the sphere. Utilizing a faceted polygonal mesh would introduce inappropriate geometric speckling under a sharp specular lobe. The spatial domain is constrained to one sphere and one plinth within a controlled, dark gallery environment.
  10. Excluded rendering features. The evaluation lacks Fresnel approximations, GGX microfacet distributions, Smith shadowing-masking functions, HDRI environment mapping, and Multiple Importance Sampling (MIS). The lighting model relies purely on 1-bounce direct illumination from a finite disk complemented by a constant ambient fill.
  11. Whole-frame RMSE is not the lesson. Relying on a global error metric mathematically conflates the highly divergent variance properties characterizing regions H and S.
  12. Not DLSS / OIDN / SVGF / ReSTIR. This investigation focuses on offline Monte Carlo convergence properties over varying sample counts, not the efficacy of modern spatial-temporal denoisers applied to 1-spp inputs.
  13. Tone mapping constants. The Khronos PBR Neutral parameters are directly inherited from established tone-mapping documentation and remain strictly fixed; they are deliberately not re-fit per sampling iteration.
  14. Cousin methodologies. While Visual Normal Distribution Function (VNDF) sampling represents the modern production standard for this family of lobes, and Veach's MIS formally addresses Lambertian starvation, they function only as comparative theoretical cousins to the specific estimators analyzed herein.

Mesa / llvmpipe — what this run can claim

item value
GL_VERSION 4.5 (Core Profile) Mesa 25.0.7-2+deb13u1
GL_RENDERER llvmpipe (LLVM 19.1.7, 256 bits)
OSMesa core 3.3 request; driver reports 4.5 core
FBO color RGBA32F complete, 1280×7201280\times 720. 8-bit fallback not hit
GL_FRAMEBUFFER_SRGB disabled (Neutral + sRGB OETF on CPU)
MSAA disabled
Beauty / composite 960×540960\times 540 / 1280×7201280\times 720
Neutral ee 1.00
seed / hash 329363537 / pcg
key finite disk, 3.600° from the highlight point

Can claim: Executed on this specific OSMesa / llvmpipe build, the numerical integration of the defined integral utilizing a cosine versus a Phong-IS distribution at the parameterized NN and ss settings deterministically yields the published RMSEH\mathrm{RMSE}_H, RMSES\mathrm{RMSE}_S, and discrete firefly metrics. The diagnostic heat plate mathematically maps this residual variance, and the 3-up composite verifies the visual consequence of altering only the probability density function pp.

Cannot claim: This evaluation does not represent hardware-accelerated ray tracing, establish a real-time computational budget, or assert that "Phong is the optimal production sampler." It does not guarantee radiometric energy preservation following the application of the Neutral tone mapper, nor does it derive structural conclusions from JPEG artifacts. The analysis is thoroughly decoupled from discrete-GPU hardware performance metrics, warp occupancy characteristics, memory bandwidth profiling, or broader architectural performance assertions.


Out of scope

Additionally, the scope of this analysis explicitly excludes spectral path tracing, the evaluation of spatial or temporal denoisers (e.g., DLSS, SVGF, OIDN, ReSTIR) on the rendered stills, multi-bounce global illumination, and the deployment of next-event estimation as an independent Monte Carlo sampling arm. Furthermore, we omit discussions regarding linearly transformed cosines (LTC) for area lights, shadow-map biasing, Toksvig filtering, anisotropic GGX distributions, and texture color space decoding (sRGB versus linear). The generation of an alternate photographic set for publication covers or hero images is similarly excluded. Finally, we make no assertions regarding real-time path-tracing performance, hardware ray-tracing (RT) core utilization, wavefront occupancy, or memory bandwidth efficiency; such hardware-level metrics remain strictly outside the bounds of this note.


Dense meters follow.


Appendix A — Meters (quote tables, not photographs)

Instrument. Snapshot of the float-buffer table. RMSE / var / fireflies from linear Rec.709 Y, never JPEG. Not a cover.
Instrument. Snapshot of the float-buffer table. RMSE / var / fireflies from linear Rec.709 Y, never JPEG. Not a cover.

The following empirical data is extracted directly from the float buffer rendered via Mesa llvmpipe. All RMSE, variance, and firefly metrics operate on linear Rec.709 YY luminance, explicitly bypassing JPEG compression. Firefly artifacts are identified using a threshold of k=4k=4. The primary stochastic evaluations utilize the seed 329363537, whereas the reference image relies on the seed 1374605335, both generated via a PCG hash.

Pass predicate, N=64N=64, s=32s=32:

pdf RMSEH\mathrm{RMSE}_H RMSES\mathrm{RMSE}_S fireflies varH\mathrm{var}_H horizon_frac Ymean\mathrm{Y_{mean}}
uniform 9.900829 0.133294 14400 90.03990936 0 0.145754
cosine 7.655620 0.140667 21536 56.92735672 0 0.146241
phong 1.999657 0.824834 1653 3.95137548 0.025246 0.059415

RMSEH(phong)<RMSEH(cosine)\mathrm{RMSE}_H(\mathrm{phong})<\mathrm{RMSE}_H(\mathrm{cosine}): 1.999657 << 7.655620. PASS.

NN progression, s=32s=32, RMSEH\mathrm{RMSE}_H:

NN cosine phong
4 27.886635 8.377738
16 15.989179 4.037456
64 7.655620 1.999657
256 3.837384 1.010789

Exponent control, Phong-IS, N=64N=64:

ss RMSEH\mathrm{RMSE}_H RMSES\mathrm{RMSE}_S fireflies horizon_frac Ymean\mathrm{Y_{mean}}
8 1.783442 0.879714 2897 0.084079 0.102782
32 1.999657 0.824834 1653 0.025246 0.059415
128 7.367447 0.860317 587 0.002089 0.030926

White furnace (Li≡1L_i\equiv 1, R=nR=n, lobe off-horizon):

Sampler Measured YY Expected Band
Cosine, ρd+ρs\rho_d+\rho_s 0.2923 0.2917 PASS (<0.04<0.04)
Phong, ρs\rho_s only 0.1200 0.1200 PASS (<0.03<0.03) — s+1s+1 vs s+2s+2
Phong, ρd+ρs\rho_d+\rho_s 0.1930 0.2917 short; inverse-CDF tail, see Failure B

Header constants, exactly as parameterized:

item value
seed / ref_seed 329363537 / 1374605335
exposure / TM 1.000 / Khronos PBR Neutral (not re-fit)
firefly kk 4.0
key angular radius / diskr\mathrm{disk}_r 3.600° / 0.1372
LkeyL_{\mathrm{key}} / LfillL_{\mathrm{fill}} (980.0,880.0,720.0)(980.0,880.0,720.0) / (1.200,1.380,1.620)(1.200,1.380,1.620)
ρd\rho_d / ρs\rho_s / ss (0.155,0.175,0.188)(0.155,0.175,0.188) / 0.120 / 32
ROIH\mathrm{ROI}_H / ROIS\mathrm{ROI}_S (502,391,555,432)(502,391,555,432) / (349,133,613,319)(349,133,613,319) inclusive, beauty 960×540960\times 540

For high-level summaries, hero metrics are rounded as follows: RMSEH\mathrm{RMSE}_H reduces to 7.66 and 2.00; RMSES\mathrm{RMSE}_S reduces to 0.141 and 0.825; firefly counts are cited as 21536 and 1653; the key light angular radius is 3.600°; the random seed is 329363537; and the pass/fail ratio is 24 pass to 0 fail. We caution against estimating RMSE values visually from the hero image, the 3-up comparison, or the surround crop. Those frames are explicitly labeled as photo-only. The subsequent metrics strip constitutes a scientific snapshot of this exact data table, ensuring all cited values originate directly from the uncompressed float buffer.

Appendix B — Assertions

This run: 24 pass / 0 fail.

check result
FBO is RGBA32F PASS
Required gallery plates exist and are non-empty PASS
No NaNs in the estimator PASS
Sphere / plinth pixel counts PASS (>2000>2000 / >200>200)
White-furnace cosine ∣Y−(ρd+ρs)∣<0.04\lvert Y-(\rho_d+\rho_s)\rvert<0.04 PASS 0.2923 vs 0.2917
White-furnace Phong spec-only ∣Y−ρs∣<0.03\lvert Y-\rho_s\rvert<0.03 PASS 0.1200
ROI H/S non-empty PASS (502,391,555,432)(502,391,555,432) / (349,133,613,319)(349,133,613,319)
RMSEH(phong)<RMSEH(cosine)\mathrm{RMSE}_H(\mathrm{phong})<\mathrm{RMSE}_H(\mathrm{cosine}) at N=64N=64, s=32s=32 PASS 1.999657 << 7.655620

No assertion tolerances were relaxed to artificially suppress cosine fireflies or obscure the diffuse starvation characteristic of the Phong estimator.