30 A Mathematical Model of Microsurface Normal Distribution for Specular Bidirectional Reflectance Distribution Function Ivan Dychka, Yevgeniya Sulema, Constantine Rudenko Faculty of Applied Mathematics, Igor Sikorsky Kyiv Polytechnic Institute, Ukraine, Kyiv, 37 Peremohy ave., email: {dychka, sulema}@pzks.fpm.kpi.ua, const.int@protonmail.com Abstract: This paper presents a new mathematical In [6], Heitz and d’Eon proposed an importance sampling model of microsurface normal distribution. The proposed scheme for microfacet-based BSDFs. The authors claim that model retains a long highlight tail even with roughness the performance of this scheme is suitable for both offline coefficient extremely close to zero which matches the and GPU rendering. behavior of measured material samples. The proposed Heitz in [7] presented the masking-shadowing functions model obeys the energy conservation law and can be used (geometric attenuation factors) in microfacet-based BRDFs in Physically-Based Rendering (PBR) shaders to create and provided explanations on their applications. realistic and visually pleasing specular highlights. The Hanika et al. in [8] proposed an advancement of microfacet results of using the proposed model are demonstrated and theory based on the Smith model in order to include discussed. The highlight shape created by this model is microsurface multiple scattering at rough material interfaces compared against several existing models as well as for reflectance and transmission. The authors compared the empirical data. predictions made by their model with results obtained by Keywords: Physically-Based Rendering, Specular simulating multiple scattering on explicit microsurfaces Reflection, Normal Distribution, Realistic Rendering. generated with a noise primitive. Walteret et al. in [9] provided a review of the microfacet I. INTRODUCTION theory and demonstrated how it can be extended to simulate transmission through rough surfaces such as etched glass. Nowadays there are several models of microsurface normal In [10], Dupuy et al. introduce the Symmetric GGX distribution available for specular Bidirectional Reflectance distribution to represent spatially-varying properties of Distribution Function (BRDF) ranging from minimalistic anisotropic microflake participating media. ones like Blinn-Phong to complex models like Cook- Despite of availability of these and other promising results Torrance [1], Trowbridge-Reitz [2], Backmann [3], and other a need of new models development still exists. models. However, such models suffer from the same problem – with low roughness values the tail of the highlight is not nearly long enough even with the most advanced III. MODEL DESCRIPTION models. The proposed model is based on an assumption that the The research presented in this paper is aimed at creating a surface contains cavities of different depths with deeper new model of normal distribution for specular BRDF that cavities being less probable. In order to calculate the would retain realistically long highlight tail with low brightness of a given surface the following steps are roughness values. performed: • Calculation of the depth of a cavity that would reflect II. RELATED WORK given light direction vector to the direction of given view vector; There is a relatively large number of research papers • Calculation of the probability of required cavity. devoted to solving similar tasks. The reflection of light vector which hits a cavity is Thus, Dupuy et al. proposed in [4] a reflectance filtering demonstrated in Fig. 1. technique for displacement mapped surfaces called Linear The height of a cavity which reflects a given light vector Efficient Antialiased Displacement and Reflectance mapping. into view vector is calculated using following the formula: The authors assert that their method is compatible with animation and deformation, making it general and flexible. Gartley et al. presented in [5] the framework for a new p- (1) BRDF prediction tool leveraging the radiometric ray-tracing framework of the Digital Imaging and Remote Sensing Image where h is the height of the cavity and b is the Blinn term. Generation model. The authors state that predictions from the The plot of cavity height function in relation to Blinn term tool have been verified for clean, randomly rough surfaces is presented in Fig. 2. against a generalized, analytical p-BRDF model. After calculation of the cavity height, the probability distribution must be applied. Because Gaussian Distribution ACIT 2018, June 1-3, 2018, Ceske Budejovice, Czech Republic 31 Function does not provide the desired result, the proposed The integral of this function over ϕ ∈ (0; π) does converge model uses a custom distribution function: and is equal to: (2) (4) where f is the distribution coefficient, h is the height of the cavity, and r is the surface roughness coefficient. This function is not normalized (does not integrate to 1) and, thus, The dividing of the proposed distribution function by this should be divided by its integral to be used as a probability integral yields the normalized NDF ready to be used for distribution. modelling specular reflections: (5) where P (ϕ, r) is the probability of the required cavity, r is the a surface roughness coefficient, and cos(ϕ) is the Blinn term. In order to maintain consistency, it is proposed to use the described NDF with a custom geometric masking function based on the same microsurface model. The proposed geometric masking function describes the decrease of visible highlight due to microsurface cavity being obscured from light source and from the viewer by adjacent b microsurface apex as demonstrated in Fig. 3. Fig. 1. Reflection cases: a – outside a cavity, b – inside a cavity However, the integral of this function over h ∈ (0; ∞) does not converge. But instead it is possible to integrate the total amount of reflected light over ϕ ∈ (0; π) where ϕ is the angle between the cavity normal and the surface normal, thus, preserving the energy conservation law. Fig. 3. Demonstration of geometrical masking: surface is black, yellow and blue colors represent light and shadow respectively The masking term is derived by dividing the length of visible (for view masking) or lit (for light masking) part of microsurface cavity slope by its total length (Fig. 4). Fig. 2. The plot of cavity height function (vertical axis is the height of theoretical cavity, horizontal axis is Blinn term) The resulting Normal Distribution Function (NDF) without normalization is: (3) Fig. 4. Masking term derivation (ϕ is the angle between macrosurface normal and light vector, β is the angle between macrosurface and microsurface slope) where f is the distribution coefficient, r is surface roughness, The total microsurface slope length can be described as: and ϕ is the angle between the surface normal and the cavity normal as well as cos(ϕ) is the Blinn term. ACIT 2018, June 1-3, 2018, Ceske Budejovice, Czech Republic 32 where m is the masking coefficient, ϕ is the angle between (6) the macrosurface normal and the light vector, and β is the angle between the microsurface slope and the macrosurface. where l total is the total microsurface slope length and ϕ is the The total masking coefficient should be calculated as the angle between the macrosurface normal and the light vector. lowest value between light masking and view masking: The visible part of the slope is equal to: (11) (7) where l visible is the visible part of the microsurface slope, l total is the total microsurface slope length, ϕ is the angle between the macrosurface normal and the light vector, and β is the where m is the total masking coefficient, γ is the angle angle between the microsurface slope and the macrosurface. between the macrosurface normal and the view vector, ϕ is Thus, the masking coefficient is equal to: the angle between the macrosurface normal and the light vector, and β is the angle between the microsurface slope and the macrosurface. (8) IV. RESULTS AND DISCUSSION where m is the masking coefficient, ϕ is the angle between The proposed model creates a long highlight tail which the macrosurface normal and the light vector, and β is the looks more similar to empiric measurements as demonstrated angle between the microsurface slope and the macrosurface. in Fig. 5 and Fig. 6. The masking function can be also presented as follows: In fact, the highlight tail of the proposed model is brighter than empirical data and, thus, may require further adjustment (9) to achieve better realism in renders. Using proposed model for rendering specular highlights creates a smoother and more realistic result as shown in Thus, the final masking coefficient formula is: Fig. 7. (10) a b c d Fig. 5. Demonstration of highlights: a – measured data from chrome sample, b – proposed model, c – Trowbridge-Reitz model, d – Beckmann model [3] Fig. 6. Comparison of three normal distribution models: the purple line corresponds to Blinn-Phong model, the green line corresponds to Trowbridge-Reitzmodel model, and the black line corresponds to a proposed model ACIT 2018, June 1-3, 2018, Ceske Budejovice, Czech Republic 33 a b c Fig. 7. Demonstration of different normal distribution models: a – Beckmann model, b – Trowbridge-Reits model, c – the proposed model a b Fig. 8. Proposed masking term demonstration: a – render without a masking term, b – render with the proposed masking term [5] M.G. Gartley, S.D. Brown and J.R. Schott, “Micro-scale V. CONCLUSION Surface and Contaminate Modeling for Polarimetric The proposed model retains a long highlight tail even with Signature Prediction”, Proceedings of SPIE’08, Vol. 6972, roughness coefficient extremely close to zero yielding more pp. 1-11, 2008. appealing renders. However, it is also computationally [6] E. Heitz and E. d’Eon, “Importance Sampling Microfacet- Based BSDFs using the Distribution of Visible Normals”, intensive. Besides, it must be noted that the highlight tail of Proceedings of Eurographics Symposium on Rendering, the proposed model in fact seems brighter than measured data Vol. 33 (2014), No 4, pp. 103-112, 2014. and, thus, it may need to be adjusted in order to achieve [7] Eric Heitz, “Understanding the Masking-Shadowing better realism. Function in Microfacet-Based BRDFs”, Journal of Computer Graphics Techniques, Williams College, Vol. 3 REFERENCES (2), pp.32-91, 2014. [1] Robert L. Сook, Kenneth E. Torrance, “A reflectance [8] Eric Heitz, Johannes Hanika, Eugene d’Eon, Carsten model for computer graphics”, ACM Transactions on Dachsbacher, “Multiple-Scattering Microfacet BSDFs Graphics, Vol. 1, No. 1, January 1982. with the Smith Model”, ACM Trans. Graph., Vol. 35, [2] T. S. Trowbridge and K. P. Reitz, “Average irregularity Issue 4, Article 58, pp. 1-14, 2016. representation of a rough surface for ray reflection”, [9] Bruce Walter, Stephen R. Marschner, Hongsong Li, Journal of the Optical Society of America, Vol. 65, Issue Kenneth E. Torrance, “Microfacet models for refraction 5, pp. 531-536, 1975. through rough surfaces”, Proceeding of the 18th [3] P. Beckmann and A. Spizzichino, “The scattering of Eurographics conference on Rendering Techniques, pp. electromagnetic waves from rough surfaces”, MacMillan, 195-206, 2007. 1963. [10] Eric Heitz , Jonathan Dupuy, Cyril Crassin, Carsten [4] Jonathan Dupuy, Eric Heitz, Jean-Claude Iehl, Pierre Dachsbacher, “The SGGX microflake distribution”, Poulin, Fabrice Neyret, Victor Ostromoukhov, “Linear Journal ACM Transactions on Graphics, Vol. 34 Issue 4, Efficient Antialiased Displacement and Reflectance Article No. 48, 2015. Mapping”, ACM Transactions on Graphics, Vol. 32, No. 6, Article 211, pp. 1-11, 2013. ACIT 2018, June 1-3, 2018, Ceske Budejovice, Czech Republic