Abstract
The Phong and Modified Phong specular BRDFs, although of limited physical basis, are nevertheless some of the simplest BRDFs exhibiting glossy and specular qualities to understand and to implement, making them useful for validation and teaching. Unfortunately, although it is well-known how to make these BRDFs conserve energy (that is, never gain energy), making them energy-normalized (that is, never lose nor gain energy) is far more difficult. Lesser-known algorithms exist, but require the specular exponent n to be integer-valued, and have O(n) runtime cost. We express these algorithms as mathematical formulae and generalize to the real-valued specular exponent case. We then simplify and optimize to finally attain an algorithm that is O(1). Energy normalization makes the Phong BRDFs more physically plausible and therefore both more practically and theoretically useful—and our improvements allow for this energy normalization to be done efficiently and without arbitrary limitations.
Similar content being viewed by others
Notes
As in other multi-layer composite-BRDF models, one would typically weight the specular term by the Fresnel reflection and the diffuse term by the Fresnel transmission.
The double-factorial function \(n!!=n(n-2)(n-4)\cdots (1)\) must not be confused with the factorial function \(n!=n(n-1)(n-2)\cdots (1)\) applied twice.
The gamma function \(\Gamma {\left( \cdots \right) }\) generalizes the factorial function from the non-negative integers to most complex numbers. For any positive integer n, we have \(\Gamma {\left( n\right) }=(n-1)!\), but in particular \(\Gamma {\left( \cdots \right) }\) also works for floating-point values.
Profiling small sections of code is theoretically problematic (e.g. pipelining, caching, context-switching and reordering issues), but we report on our best effort on an Intel i7-6850K.
References
Arvo, J.: Applications of irradiance tensors to the simulation of non-lambertian phenomena. In: Proceedings of the 22nd Annual Conference on Computer Graphics and Interactive Techniques, SIGGRAPH ’95, pp. 335–342. ACM, New York, NY, USA (1995). http://doi.acm.org/10.1145/218380.218467
Beckmann, P., Spizzichino, A.: The scattering of electromagnetic waves from rough surfaces. Norwood, MA, Artech House, Inc., 1987, 511 p. (1987)
Boost: Boost C++ Libraries. http://www.boost.org/ (1999)
Dutré, P.: Global illumination compendium. Tech. rep., Katholieke Universiteit Leuven (2003). https://people.cs.kuleuven.be/~philip.dutre/GI/
Heitz, E., Hanika, J., d’Eon, E., Dachsbacher, C.: Multiple-scattering microfacet bsdfs with the smith model. ACM Trans Graph 35(4), 1–14 (2016)
Kajiya, J.T.: The rendering equation. In: Proceedings of the 13th Annual Conference on Computer Graphics and Interactive Techniques, SIGGRAPH ’86, pp. 143–150. ACM, New York, NY, USA (1986). http://doi.acm.org/10.1145/15922.15902
Kulla, C., Conty, A.: Revisiting physically based shading at imageworks. SIGGRAPH Course, Physically Based Shading (2017)
Lecocq, P., Dufay, A., Sourimant, G., Marvie, J.E.: Analytic approximations for real-time area light shading. IEEE Trans Visual Comput Graph 23(5), 1428–1441 (2017)
Lee, J.H., Jarabo, A., Jeon, D.S., Gutierrez, D., Kim, M.H.: Practical multiple scattering for rough surfaces. ACM TOG 37(6), 1–12 (2018)
Lewis, R.R.: Making shaders more physically plausible. Computer Graph Forum 13(2), 109–120 (1994). https://doi.org/10.1111/1467-8659.1320109
Meta.Numerics: Meta.numerics. http://www.meta-numerics.net/ (2009)
Nicodemus, F.E.: Directional reflectance and emissivity of an opaque surface. Appl Opt 4(7), 767–775 (1965)
Parker, S.G., Bigler, J., Dietrich, A., Friedrich, H., Hoberock, J., Luebke, D., McAllister, D., McGuire, M., Morley, K., Robison, A., Stich, M.: Optix: A general purpose ray tracing engine. In: ACM SIGGRAPH 2010 Papers, SIGGRAPH ’10, pp. 66:1–66:13. ACM, New York, NY, USA (2010). http://doi.acm.org/10.1145/1833349.1778803
Phong, B.T.: Illumination for computer generated pictures. Commun. ACM 18(6), 311–317. https://doi.org/10.1145/360825.360839
Torrance, K.E., Sparrow, E.M.: Theory for off-specular reflection from roughened surfaces. Josa 57(9), 1105–1114 (1967)
Turquin, E.: Practical multiple scattering compensation for microfacet models. ILM (2019)
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
The authors declare that they have no conflict of interest.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendices
A: Derivation of energy normalization criterion
The following informal proof demonstrates the well-known BRDF normalization criterion. We start with 1:
Then, since the incoming irradiance \(E_e = d \Phi _i/d A\) must match the outgoing radiant exitance \(M_e = d \Phi _o/d A\):
B: Derivation of energy conservation
Unlike energy normalization, which is the subject of this paper, the derivation of energy conservation terms for the Phong BRDFs is widely known.
Consider the Modified Phong specular component BRDF. In Eq. 5, first assume that \({\varvec{\upomega }_i = \varvec{N}}\):
Then, since the dot product of the reflected vector must be nonnegative and the same as that of the original vector:
The computation of \(I_P\) with Eq. 4 is analogous.
C: Example code
Although the normalization terms given by Eqs. 7 and 8 may look intimidating, we provide a listing of the key source code, with simple optimizations applied, to demonstrate that our approach can be implemented in only a few lines:
The incomplete beta function is the only omission from the above, since it is not provided by most implementations of the C/C++ standard library. However, there is no shortage of available implementations to choose from. For example, the function from Boost [3] will be available to many users; the additional implementation would look like:
In our experiments, we chose to adapt the implementation of [11], because it seems to be based on a newer method. Such choices also in principle affect the epsilon at which the incomplete beta term must be replaced with its limit. However, empirically, our implementation was stable down to \(n \approx 5 \times 10^{-37}\), so a very small epsilon, as-above, is still adequately conservative.
Rights and permissions
About this article
Cite this article
Mallett, I., Yuksel, C. Constant-time energy-normalization for the Phong specular BRDFs. Vis Comput 36, 2029–2038 (2020). https://doi.org/10.1007/s00371-020-01954-x
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00371-020-01954-x