# Convolution of Hemispherical Harmonics

Spherical Harmonics (SH) are a way to represent low-frequency spherical functions with only a handful of coefficients. They have some nice mathematical properties, e.g. a convolution with a kernel function h(x) (that has circular symmetry) can be calculated as

In the case of a convolution with a cosine lobe for rank 3 SH this results in a simple scaling of the bands with the factors

In many cases, e.g. incident light for a given point on an opaque surface, full spherical information is not needed, since half of the sphere is zero / undefined / unused anyway. Thus, Hemispherical Harmonics (HSH) were born.

How does convolution with an arbitrary kernel (with circular symmetry) work for HSH? Can the convolution from SH be extended or is there any paper that goes into details on this?

• You write "arbitrary kernel with circular symmetry": Doesn't that mean that you actually only need the convolution with the (Hemispheric) Zonal Harmonics part? If your symmetry axis is different you can still use it by adding rotations before and after the Zonal convolution. How to perform rotations is described in the paper. Integration with the Zonal part (m=0) should be comparatively easy. However, as with Spherical Harmonics, it won't be analytically solvable for arbitrary functions. Simple things like cosine lobes should work fine (haven't tried yet though). – Wumpf Sep 27 '15 at 12:46
• @Wumpf You're right, that's pretty much what it boils down to. For SH, I'd just scale "each band of f by the corresponding m=0 term from [kernel function] h" (quoting Sloan's Stupid SH Tricks). Question is, can I do the same for HSH? – David Kuri Sep 28 '15 at 7:42

This answer tries to give a short overview over some important aspects. Since the HSH definition is rather complex and I couldn't find an overview over some pre-evaluated functions, I didn't provide examples simply because it would take me too much time right now.

## Problem Description & Brute Force

To determine the convolution any with any set of basis function and thus computing the coefficients we generally need to compute the integral over the domain (= sphere for SH, hemisphere for HSH). Everything we need to do, to represent the hemispherical function f, which is defined over the angles theta ("up/down") and phi ("left/right"), via a coefficient c for HSH basis functions H is the following:

The sin(theta) is there because we integrate over the surface of a (hemi-)sphere. Conceptually, the size of a piece of area that comes from changing phi is bigger or smaller on the current theta. More on this here

If we don't care too much about accuracy or computing time we can solve this simply by sampling: Generate equally distributed (!) directions on the hemisphere, compute the product of f and H and average the outcomes (if you have truly equally distributed points you don't need the sin(theta)).

## Get Started with an Analytical Solution

Of course we would love to have an analytical solution for our function, but this is where things can get very difficult. As a first step we may need to convert a function that is given on Cartesian directions into spherical coordinates. This part is still easy, just replace all your x, y and z as following:

Note that this gives us a system where the z-axis is the "up" of the hemisphere (theta=0) which should be represented by the HSH. After that it may already be possible to insert everything into a computer algebra system and solve the equation. Do not try to solve for all m & l but rather try one coefficient at a time, since it is unlikely that there is a compact expression that describes all of them at once. The definition of HSH is relatively complex, which makes it very tedious to evaluate these functions. In this paper the zero and 1st order HSH basis functions are mentioned in cartesian coordinates.

## Notes on Rotations & Zonal Harmonics

Functions that are rotational symmetric around this z-axis are very good candidates for a successful analytic derivation, since they only affect the zonal coefficients, which are all coefficients with index m equals zero. This is especially helpful for the more general Spherical Harmonics where an easy formula exists that allows to rotate any Zonal Spherical Harmonics representation to an arbitrary direction, resulting in a Spherical Harmonics representation without any data loss (see here). This means that you can derive ZSH coefficients by assuming that your radial symmetric "function points to z" and rotate it then it into any desired direction. This works perfectly for example with various cosine lobe variations and also gives you the factors you mentioned in the question.

Now the bad news: For HSH, any rotation of a function around another axis than z is lossy, since your function will "touch" the lower undefined hemisphere after the rotation. Therefore, there is also no convenient "Hemi Zonal to HSH" rotation formula. Instead, there are multiple ways to do it with different drawbacks. For more details see the paper and the presentation.

By the way: All this is easier with the H-Basis, which is hemispherical as well (but originally only defined for a limited number of frequency-bands).