# 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.

### ADDITIONAL

Now I think there is no need to have mips. All other LODs can be modeled continuously by using different cone angle to make convolution with saved spherical function. It is very smooth.

It seems also better to save value of color itself, not integral over footprint, because spherical harmonics allow to easily calculate integrals (just a scalar product). Especially with zonal sperical functions like integral into a solid angle inside of arbitrary oriented cone.

I think this format of textures is best for cartoon industry.

• What's the actual question? If your aim is to have a discussion, SE sites don't really work for that. (See help center for more.) – Dan Hulme Feb 9 '18 at 13:38
• But codereview.stackexchange.com is a part of SE. – Orient Feb 9 '18 at 13:43
• It is sad, that there is no ideareview SE. – Orient Feb 9 '18 at 13:45