Skip to main content
Log in

Approximations for the distribution of microflake normals

  • Original Article
  • Published:
The Visual Computer Aims and scope Submit manuscript

Abstract

Scenes in computer animation can have extreme complexity, especially when high resolution objects are placed in the distance and occupy only a few pixels. A useful technique for level of detail in these cases is to use a sparse voxel octree containing both hard surfaces and a participating medium consisting of microflakes. In this paper, we discuss three different methods for approximating the distribution of normals of the microflakes, which is needed to compute extinction, inscattering of attenuated direct illumination, and multiple scattering in the participating medium. Specifically, we consider (a) k means approximation with k weighted representatives, (b) expansion in spherical harmonics, and (c) the distribution of the normals of a specific ellipsoid. We compare their image quality, data size, and computation time.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10

Similar content being viewed by others

References

  1. Bruneton, E., Neyret, F.: A survey of non-linear pre-filtering methods for efficient and accurate surface shading. IEEE Trans. Vis. Comput. Gr. 18(3), 242–260 (2008)

    Google Scholar 

  2. Cook, R., Carpenter, L., Catmull, E.: The Reyes image rendering architecture. In: SIGGRAPH ’87: proceedings of the 14th annual conference on computer graphics and interactive techniques, pp. 95–102. ACM (1987). doi:10.1145/37402.37414

  3. Cook, R., Torrance, K.: A reflectance model for computer graphics. ACM Trans. Gr. 1(1), 7–12 (1982). doi:10.1145/357290.357293

    Article  Google Scholar 

  4. Crow, F.: A more flexible image generation environment. In: ACM SIGGRAPH ’82: Proceedings of the 9th annual conference on computer graphics and interactive techniques, vol. 16, pp. 9–18 (1982). doi:10.1145/800064.801253

  5. Green, R.: Spherical harmonic lighting: the gritty details. In: Archives of the Game Developers Conference, vol. 56 (2003)

  6. Heitz, E.: Understanding the masking-shadowing function in microfacet-based brdfs. J. Comput. Gr. Tech. 3(2), 32–91 (2014)

    Google Scholar 

  7. Heitz, E., Dupuy, J., Crassin, C., Dachsbacher, C.: The SGGX microflake distribution: supplementary material. ACM Digital Library (2015)

  8. Heitz, E., Dupuy, J., Crassin, C., Dachsbacher, C.: The SGGX microflake distribution. ACM Trans. Gr. 34(4), 48 (2015)

    Article  MATH  Google Scholar 

  9. Heitz, E., Neyret, F.: Representing appearance and pre-filtering subpixel data in sparse voxel octrees. In: Dachsbacher, C., Munkberg, J., Pantaleoni, J. (eds.) Eurographics/ ACM SIGGRAPH symposium on high performance graphics. The Eurographics Association (2012). doi:10.2312/EGGH/HPG12/125-134

  10. Heitz, E., Nowrouzezahrai, D., Poulin, P., Neyret, F.: Filtering color mapped textures and surfaces. In: Proceedings of I3D, pp. 129–136. ACM (2013)

  11. Hoppe, H.: Progressive meshes. In: ACM SIGGRAPH ’96: proceedings of the 24th annual conference on computer graphics and interactive techniques, pp. 99–108. ACM Press (1996). doi:10.1145/237170.237216

  12. Hoppe, H.: View-dependent refinement of progressive meshes. In: ACM SIGGRAPH ’97: proceedings of the 24th annual conference on computer graphics and interactive techniques, pp. 189–198. ACM Press/Addison-Wesley Publishing Co., New York (1997). doi:10.1145/258734.258843

  13. Jakob, W., Arbee, A., Moon, J.T., Bala, K., Marschner, S.: A radiative transfer framework for rendering materials with anisotropic structure. ACM Transactions on Graphics (TOG)—proceedings of ACM SIGGRAPH 2010 29(4) (2010). doi:10.1145/1778765.1778790

  14. Jarosz, W., Carr, N., Jensen, H.W.: Importance sampling spherical harmonics. Comput. Gr. Forum 28(2), 577–586 (2009). doi:10.1111/j.1467-8659.2009.01398.x

    Article  Google Scholar 

  15. Jensen, H.W.: Realistic Image Synthesis Using Photon Mapping. A K Peters/CRC Press, Boca Raton (2012)

    Google Scholar 

  16. Joy, K.I., Grant, C.W., Max, N.L., Hatfield, L.: Tutorial: computer graphics: image synthesis. ACM Press, p 2 (1988)

  17. Kainz, F., Bogart, R.: https://github.com/openexr/openexr/tree/master/ilmbase/half (2002)

  18. Kanungo, T., Mount, D.M., Netanyahu, N., Piatko, C., Silverman, R., Wu, A.Y.: A local search approximation algorithm for k-means clustering. Comput. Geom. Theory Appl. 28, 89–112 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  19. Kaplanyan: Cryengine 3: reaching the speed of light. In: SIGGRAPH 2010: advances in Real-time Rendering course (2010)

  20. Max, N.: Optical models for direct volume rendering. IEEE Trans. Vis. Comput. Gr. 1, 99–108 (1995)

    Article  Google Scholar 

  21. Max, N., Mobley, C., Wu, E.H.: Plane-parallel radiance transport for global illumination in vegetation. In: Rendering techniques ’97: proceedings of eurographics workshop on rendering, pp. 239–250. Springer, Berlin (1997)

  22. Moon, J., Walter, B., Marschner, S.: Efficient multiple scattering in hair using spherical harmonics. ACM Trans. Gr. 27(3), 1–7 (2008)

    Article  Google Scholar 

  23. Neyret, F.: Modeling animating and rendering complex scenes using volumetric textures. IEEE Trans. Vis. Comput. Gr. 4(1), 55–70 (1998). doi:10.1109/2945.675652

    Article  Google Scholar 

  24. Olano, M., Baker, D.: Lean mapping. In: Proceedings of I3D’10, pp. 181–188. ACM (2010)

  25. Olano, M., North, M.: Normal distribution mapping. Tech. Rep. TR97-041, Department of Computer Science, University of North Carolina, Chapel Hill (1997)

  26. Ramamoorthi, R., Hanrahan, P.: On the relationship between radiance and irradiance: determining the illumination from images of a convex Lambertian object. J. Opt. Soc. Am. A 18(10), 2448–2459 (2001)

    Article  MathSciNet  Google Scholar 

  27. Rense, W.: Polarization studies of light diffusely reflected from ground and etched glass surfaces. J. Opt. Soc. Am. 40(1), 55–59 (1950). doi:10.1364/JOSA.40.000055

    Article  Google Scholar 

  28. Sloan, P.P.: Stupid spherical harmonics (sh) tricks. Microsoft Corporation (2008). Expanded material from presentation at the 2008 Game Developer Conference. http://www.ppsloan.org/publications/StupidSH36.pdf

  29. Toksvig, M.: Mipmapping normal maps. J. Gr. Tools 10(3), 65–71 (2005)

  30. Torrance, K., Sparrow, E.: Theory for off-specular reflection from roughened surfaces. J. Opt. Soc. Am. 57(9), 1105–1114 (1967)

    Article  Google Scholar 

  31. Walter, B., Marschner, S.R., Li, H., Torrance, K.E.: Microfacet models for refraction through rough surfaces. In: Kautz, J., Pattanaik, S. (eds.) Rendering techniques, pp. 105–205. The Eurographics Association (2007). doi:10.2312/EGWR/EGSR07/195-206

  32. Zhao, S.: Modeling and rendering fabrics at micron resolution. Ph.D. thesis, Cornell University (2014)

  33. Zhao, S., Jacob, W., Marchner, S., Bala, K.: Building volumetric appearance of fabrics using micro CT imaging. ACM Trans. Gr. 30(4), 44:1–44:10 (2011)

Download references

Acknowledgements

We thank Mark Meyer, Tony DeRose, Eric Heitz, Wojciech Jarosz, Derek Nowrouzezahrai and Ted Kim for helpful discussions, and the SIGGRAPH, Pacific Graphics, and Visual Computer reviewers for useful suggestions. Nelson Max thanks the University of California, Davis for sabbatical salary.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Nelson Max.

Electronic supplementary material

Below is the link to the electronic supplementary material.

Supplementary material 1 (mov 12458 KB)

A rotation cycle around a forest, generated by path tracing using ellipsoid method (c) for the distribution of microflake normals.

Supplementary material 2 (mov 12401 KB)

The camera moves away from the forest, with continuously changing octtree levels used in the rendering. Generated using method (b) for the distribution of microflake normals, with the 15 even-ordered spherical harmonics terms for L = 4.

Supplementary material 3 (mov 12361 KB)

A rotation cycle around a forest, generated by path tracing using the k-means method (a) for the distribution of microflake normals, with k = 3.

Supplementary material 4 (mov 1912 KB)

A rotation cycle around a forest, generated by path tracing using method (b) for the distribution of microflake normals, with the 15 even-ordered spherical harmonics terms for L = 4.

Supplementary material 5 (mov 6943 KB)

A rotation cycle around a beech tree, generated by path tracing using method (b) for the distribution of microflake normals, with the 15 even-ordered spherical harmonics terms for L = 4.

Appendix

Appendix

In this appendix, we give some formulas for the spherical harmonics calculations discussed above. Good references for the mathematics of spherical harmonics as applied to computer graphics are [28] and [5]. Sloan [28] gives simple formulas for the \(Y_{lm}(\omega )\) in the form of polynomials of degree l in the x, y, and z coordinates of the unit vector \(\omega \), which we used in our implementation.

To compute the extinction integral in Eq. (3) using an \(h(\omega )\) of the form of Eq. (1), we expand the nonnegatively clamped cosine of \(\theta \), \(A(\theta )\), into spherical harmonics. Since this function is independent of \(\phi \), all the coefficients with \(m \ne 0\) are zero so we get just the “zonal” harmonics expansion

$$\begin{aligned} A(\theta , \phi ) \approx \sum _{l = 0}^L A_{l0}Y_{l0}(\theta , \phi ) \end{aligned}$$
(12)

where, by Eq. (2),

$$\begin{aligned} A_{l0} = 2\pi \int _0^{\pi /2} Y_{l0} (\theta , \phi ) \text { cos}\theta \text { sin}\theta \,\mathrm{d}\theta \,\mathrm{d}\phi . \end{aligned}$$
(13)

Ramamoorthi and Hanrahan [26] (please see the correction of their Eq. (19) at the bottom of the web page http://cseweb.ucsd.edu/ravir/papers/invlamb/) give the formula for the coefficients \(A_{l0}\), which are zero for odd \(l > 1\), and decrease rapidly for increasing even l. We have used only the first few values \(A_{00} = \sqrt{\pi }/2\), \(A_{10} = \sqrt{\pi /3}\), \(A_{20} = \sqrt{5\pi }/8\), \(A_{30} = 0\), and \(A_{40} = -\sqrt{\pi }/16\).

This zonal harmonic expansion is only useful for evaluating Eq. (3) if \(\omega _o\) is at the north pole of the unit sphere. For other directions of \(\omega _o\), one must rotate this zonal harmonic expansion so that its axis of symmetry is along the direction \(\omega _o\). This is simpler for zonal harmonics than for general spherical harmonics. According to [26], the result of rotating the expansion in equation (12) to make the axis of symmetry lie in the direction \(\omega _o = (\theta _o, \phi _o)\) is

$$\begin{aligned}&R^{\theta _o \phi _o}A(\theta ,\phi ) \nonumber \\&\quad \approx \sum _{l = 0}^L \sum _{m = -l}^l Y_{lm} (\theta _o, \phi _o) \sqrt{\frac{4\pi }{2l+1}}A_{l0} Y_{lm} (\theta ,\phi ). \end{aligned}$$
(14)

Thus, if Eq. (1) is the spherical harmonic expansion of the microflake normal density \(h(\omega )\), by equation (3) and the orthonormality of the SH basis functions,

$$\begin{aligned} \sigma _t(x, \theta _o , \phi _o) \approx \sum _{l = 0}^L \sum _{m = -l}^l Y_{lm} (\theta _o, \phi _o) \sqrt{\frac{4\pi }{2l+1}}A_{l0} h_{lm}. \end{aligned}$$
(15)

The inscattering integral in Eq. (4) contains the clamped cosine \(\langle \omega _n,\omega _i\rangle \) as well as \(\langle \omega _n,\omega _o\rangle \), so if \(\langle \omega _n,\omega _i\rangle \) is also expanded in spherical harmonics as in Eq. (14), we get, for the perfectly diffuse reflection of a small light source from direction \(\omega _i\) of radiance times solid angle equal to I,

$$\begin{aligned}&S(\omega _o) \nonumber \\&\quad = \int _\Omega \int _\Omega h(\omega _n) \frac{\alpha }{\pi } \langle \omega _n,\omega _i\rangle \langle \omega _n,\omega _o\rangle L(\omega _i)\mathrm{d}\omega _n \mathrm{d}\omega _i \nonumber \\&\quad = \frac{I\alpha }{\pi }\int _0^{2\pi }\int _0^{\pi } h(\theta ,\phi )R^{\theta _i \phi _i}A(\theta ,\phi )R^{\theta _o \phi _o}A(\theta ,\phi ) \nonumber \\&\quad \text { sin}\theta \mathrm{d}\theta \mathrm{d}\phi \nonumber \\&\quad \approx \frac{I\alpha }{\pi }\int _0^{2\pi }\int _0^{\pi } \sum _{l = 0}^L \sum _{m = -l}^l h_{lm}Y_{lm}(\theta , \phi ) \nonumber \\&\quad \sum _{l' = 0}^L \sum _{m' = -l'}^{l'} Y_{l'm'} (\theta _o, \phi _o) \sqrt{\frac{4\pi }{2l'+1}}A_{l'0} Y_{l'm'} (\theta ,\phi )\sum _{l'' = 0}^L \nonumber \\&\quad \sum _{m'' = -l''}^{l''} Y_{l''m''} (\theta _i, \phi _i) \sqrt{\frac{4\pi }{2l''+1}}A_{l''0} Y_{l''m''} (\theta ,\phi )\text { sin}\theta \mathrm{d}\theta \mathrm{d}\phi \nonumber \\&\quad = \frac{I\alpha }{\pi }\sum _{l = 0}^L \sum _{m = -l}^l h_{lm} \sum _{l' = 0}^L \sum _{m' = -l'}^{l'} Y_{l'm'}(\theta _o, \phi _o) \sqrt{\frac{4\pi }{2l'+1}} \nonumber \\&\quad A_{l'0} \sum _{l'' = 0}^L \sum _{m' = -l''}^{l''} Y_{l''m''} (\theta _i, \phi _i) \sqrt{\frac{4\pi }{2l''+1}}A_{l''0}T_{lml'm'l''m''}\nonumber \\ \end{aligned}$$
(16)

where \(T_{lml'm'l''m''}\) is the “triple product integral”

$$\begin{aligned}&T_{lml'm'l''m''} \nonumber \\&\quad = \int _0^{2\pi }\int _0^{\pi }Y_{lm}(\theta ,\phi )Y_{l'm'} (\theta ,\phi )Y_{l''m''}(\theta ,\phi ) \ \text { sin}\theta \,d\theta \,d\phi .\nonumber \\ \end{aligned}$$
(17)

For order \(L = 4\), the potential number of triple product integrals is \(25^3\) = 15,625, not accounting for symmetries in the indices, but only 1,158 of them are nonzero, and these are precomputed and stored in a sparse table. In fact, since \(A_{30} = 0\), only 605 terms are actually included in the sum in Eq. (16), and if the microflakes are double-sided, and we approximate \(|\mathrm {cos}(\theta )|\) by \(A(\theta , \phi ) + A(-\theta , \phi )\), all terms with \(l'\) = 1 or \(l''\) = 1 also disappear, and only 585 terms remain.

Note that if \(\omega _o = (\theta _o, \phi _o)\) is fixed, grouping the terms and factors from \(h(\omega _n) \langle \omega _n,\omega _o\rangle \) in the last form in Eq. (16) into the large parentheses below gives a spherical harmonic expansion in the direction variable \(\omega _i = (\theta _i, \phi _i)\).

$$\begin{aligned}&S(\omega _o) \nonumber \\&\quad = \sum _{l'' = 0}^L \sum _{m'' = -l''}^{l''} \bigg (\frac{I\alpha }{\pi }\sum _{l = 0}^L \sum _{m = -l}^l h_{lm} \sum _{l' = 0}^L \sum _{m' = -l'}^{l'} Y_{l'm'}(\theta _o, \phi _o) \nonumber \\&\qquad \times \sqrt{\frac{4\pi }{2l'+1}}A_{l'0} \sqrt{\frac{4\pi }{2l''+1}}A_{l''0} T_{lml'm'l''m''}\bigg )\; Y_{l''m''} (\theta _i, \phi _i)\nonumber \\ \end{aligned}$$
(18)

Thus, it can be importance-sampled for path tracing using the techniques of [14], or by rejection sampling. Note also from this form that once the basis function coefficients in the large parentheses have been computed, the inscattering of illumination from multiple light sources can be computed with only \((L+1)^2\) multiplications and adds for each. For a light source “at infinity” with constant \(\omega _i\), a different grouping of the terms involving instead the factors \(\langle \omega _n,\omega _i\rangle \langle \omega _n,\omega _o\rangle \) can be computed once per viewing ray that hits microflakes, allowing only \((L+1)^2\) multiplications per octree cell (9.2 s for the image in Fig. 9 instead of 21.1). For finite distance light sources, using more storage, the inscattering and the extinction coefficient can be computed once per voxel as first needed and saved for subsequent viewing rays crossing the same voxel (8.4 s for the image in Fig. 9).

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Max, N., Duff, T., Mildenhall, B. et al. Approximations for the distribution of microflake normals. Vis Comput 34, 443–457 (2018). https://doi.org/10.1007/s00371-017-1352-2

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00371-017-1352-2

Keywords

Navigation