# Baked anisotropic filtering using spherical harmonics

I want to learn is it good or bad idea.

Let's assume video RAM is not a problem.

For source texture create a texture of texels: spherical functions. Spherical functions defined by small arrays of spherical harmonics coefficients up to some reasonable degree (say 3). To gather single sample for particular texel and particular coordinates on sphere (theta, phi) it is needed to integrate over the footprint (here I mean footprint assembly method) started from the textel and use this value later when spherical harmonic coefficients are calculated. Phi is exactly polar angle of the footprint on uv plane. Theta is length of the footprint up to (and from, as optimization) some reasonable length. I almost sure, that continuity is almost preserved, except bottom of the sphere (and to, where theta begins, if we starts from some threshold minimal length of a footprint).

There are possible some optimizations when performed backing of a footprints: save value of integrated color in both pixels footprint begins and ends. Calculate values for fixed number of directions and radii (and on power of two proximities). And, maybe others.

The advantage of the method is possibility to get color of whole screen pixel footprint in single sampling act. The disadvantage is requirement to prepare ($O(N^4) \approx x_{resolution} \cdot y_{resolution} \cdot n_\phi \cdot n_\theta$?) such a texture for every LOD (separately? or bilinear scaling applicable?) and huge amount of memory even for coefficients of spherical harmonics to represent a spherical function of even 3 degree ($3^2 = 9$ RGB values) for better angular and footprint length resolution.