AcademySoftwareFoundation / OpenPBR

Specification and reference implementation for the OpenPBR Surface shading model
Apache License 2.0
401 stars 17 forks source link

Add formula for the average albedo of the F82-tint model #187

Open peterkutz opened 2 months ago

peterkutz commented 2 months ago

It is possible to analytically calculate the average albedo of the F82-tint model used for metal reflectivity in OpenPBR. Specifically, the average Fresnel can be calculated by integrating the reflectivity over the cosine-weighted hemisphere.

The average Fresnel is very useful to more accurately tint the multiple-scattering component of the rough metal surface. So I propose that we include this formula in the spec.

portsmouth commented 1 month ago

This could be reasonably left as an exercise for the reader perhaps..

Though if you have a derivation of the result Peter, would be handy.

peterkutz commented 1 month ago

This was first suggested and derived by @Reedbeta :

Using the syntax from the ASM technical document, given F_F82Tint(θ) = r + (1 − r)(1 − cosθ)⁵ − bcosθ(1 − cosθ)⁶ the cosine-weighted hemispherical average of that works out to be r + (1 - r)/21 - b/126

This can be derived like this in Wolfram Alpha: integrate (r + (1 − r)(1 − cosθ)⁵ − bcosθ(1 − cosθ)⁶) * cos(θ) * sin(θ) / π from theta = 0 to π/2 and phi = 0 to 2π