brdf_microfacet — SPECULAR reflectance op

数据种类:normalmapimage2d

调用:import specularity; specularity.brdf_microfacet(normals, light=(0.0, 0.0, 1.0), view=(0.0, 0.0, 1.0), roughness=0.3, f0=0.04)(或 opsspecular.get("brdf_microfacet"))

用法

GGX / Trowbridge-Reitz 微面元镜面 BRDF。→ (H, W),单位 1/sr。

> 以下的详细说明为原文 —— 摘要与标题已翻译。

`f_s = D * G * F / (4 (n.l) (n.v))` with

• `D` the Trowbridge-Reitz (1975) / GGX normal distribution,

`a^2 / (pi * ((n.h)^2 (a^2 - 1) + 1)^2) for a = roughness^2`, which

integrates to 1 against `(n.h) dw` over the hemisphere — measured by

20000-point midpoint quadrature in `tests/test_specularity.py` at

relative errors 3.2e-07, 6.3e-08 and 4.0e-09 for roughness 0.2, 0.3 and

0.6, all of it quadrature error (the 200000-point rule gives 3.2e-09,

6.3e-10, 4.0e-11, exactly the 100x a midpoint rule predicts);

• `G` the separable Smith (1967) masking-shadowing term with the GGX

lambda;

• `F` Schlick's (1994) Fresnel approximation,

`f0 + (1 - f0) (1 - v.h)^5`. *f0* is the normal-incidence reflectance:

about 0.04 for common dielectrics, 0.5 to 1.0 for metals. When the exact

Fresnel curve matters, use `match3d.fresnel_reflectance` instead — this

is the approximation the microfacet literature specifies, and it is named

rather than hidden.

Exact ground truth it reproduces: at normal incidence with light, view and

normal aligned, every geometric factor is 1 and the value collapses to

`f0 / (4 pi roughness^4)` in closed form — reproduced bit for bit at

roughness 0.3, 0.5 and 1.0 and to 3.3e-16 relative at roughness 0.1, which

took rewriting the GGX denominator to avoid a cancellation (see the comment

at the code; the textbook arrangement was off by 2.2e-13 relative at the

peak). The lobe is reciprocal in light and view to machine precision

(measured 1.7e-16), and its maximum sits at the half-vector.

`roughness` is the perceptual parameter, squared once to reach the GGX

`alpha` — the convention that makes a linear slider feel linear. A

perfectly smooth surface (`roughness = 0`) is a delta function, not a

finite BRDF, so it is refused rather than returned as an infinity.

Raises `ValueError`: geometry problems as in

:func:brdf_blinn_phong; *roughness* outside `(0, 1]`; *f0* outside

`[0, 1]`.

详细使用指南

specular_photometric 族使用指南

参考(示例数据・文献)

• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。

• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。

• 算法的正典(作者・年份)与用途见上面的族使用指南

可运行的示例(实际调用该算子并已验证的样例)

specular_photometricpy -3.11 examples/specular_photometric.py

类型可衔接的下一个算子(可接受 image2d 作为输入)

polarization_render

同类别(reflectance)

brdf_blinn_phong · dichromatic_render


*Provenance: specularity.py — SPECULAR 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.