Hacker News new | ask | show | jobs
by jms55 542 days ago
Very very high level explanation that I'm trying to paraphrase from memory, so there's a good chance parts of it are wrong or use the wrong terminology:

A polynomial is a function like `f(x) = Ax^3 + Bx^2 + Cx^1 + Dx^0`

You can approximate most(all?) continuous functions using polynomials. The more "parts" (e.g. Bx^2 is one part) of the polynomial you have, the better you can represent a given function.

The previous example was a 1d function, but polynomials can be over any number of dimensions. E.g. a 3d polynomial `f(x, y, z)`.

Spherical harmonics are just a form of 3d polynomials, but with some special "parts" (called a basis function), with the amount of parts you have called a "band".

As for what they're good for, they're a fairly compact way of representing and filtering 3d signals.

In 3d rendering, they're really good at storing light hitting a point from different directions. You have an incoming ray of light on a unit sphere/hemisphere with origin x, y, z going towards the given point. You can then take your list of light rays with various (x,y,z) origins and (r,g,b) intensities, and then form a spherical harmonics approximation over it (basically a fitted 3d polynomial), which can be stored as just a few coefficients (A, B, C, D, etc...) using 1 or 2 bands, and cheaply computed (querying the light value r,g,b for a given ray) by plugging in the ray's x, y, z into the formula.

Besides being cheap to store and query, because you're only using 1-2 bands, you only capture the "low frequency" of the lighting signal, e.g. large changes in the light value get dropped, since it's just an approximation of the original signal. While this is normally bad, for 3d rendering, it's free denoising, giving you a smoother output image!