Live data from Hacker News

Spherical Harmonics

rhotter.com

21–30 of 65 posts

Re: Spherical Harmonics

#21
post #18

Anyone know a good explanation of what spherical harmonics are?

Just for fun... They are relatively easy to understand if you already understand Fourier transforms. In a Fourier transform you can write some (suitably well-behaved) function f(x) as a sum of a bunch of sinusoids of different frequencies: f(x) = a_0 + a_1 cos(x) + a_2 cos(2x) + ... + b_1 sin(x) + b_2 sin(2x) + ... Or more generally a sum over all real values, f(x) = ∫ a(k) cos(kx) + b(k) sin(kx) dk, since signals ca…

Thank you, this made it click for me.

Re: Spherical Harmonics

#22

Anyone know a good explanation of what spherical harmonics are?

You know if you take a metal plate bolted down at it's center, throw some salt on it and bow the edge with a violin bow. It makes stable patterns depending on the frequency of the tone playing

Now take this plate and turn it into a 3d sphere and that's spherical harmonica more or less. Electronsike to form them

Re: Spherical Harmonics

#23
If anyone is curious about applications - these can be used to approximate low-frequency components of a point's surroundings. They were used in Halo 3 to do real-time HDRI lighting and shadowing (see "Lighting and Material of Halo 3" from Siggraph 2008).

After the success of this method, there was a fairly long stretch of researchers looking for a better orthonormal basis (such as 2D Haar wavelents, as spherical harmonics is basically a Fourier Transform on a spherical basis). I think the pinnacle of this direction was Anisotropic Spherical Gaussians from 2013.

These days though, you'd at least use a neural net to learn a basis (or use a neural net to learn something else entirely). And of course, Gaussian Splats are the technique du jour for realtime relighting.

Re: Spherical Harmonics

#24

They look too big. I expected all the l=1 to be like a cone near (0,0,0). And I expected one of them to be vertical instead of horizontal.

I'm not sure about the size but I think the shapes are correct. It's just very hard to examine them when they're rotating at such high speed. Compare them to the image on this page: https://en.m.wikipedia.org/wiki/Spherical_harmonics Suggestion to OP: this would be much more useful if you add a button to stop the rotation.

... or a slider to control the rotation position or speed.

Re: Spherical Harmonics

#25

Anyone know a good explanation of what spherical harmonics are?

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!

Re: Spherical Harmonics

#27

Anyone know a good explanation of what spherical harmonics are?

Spherical harmonics are essentially orthogonal basis functions on the sphere. They are popular in 3D graphics because you can very quickly compute the sphere integral over the product of two functions, as the dot product of their basis function coefficients(!). This can be used for real-time complex lighting on relatively modest hardware.

Re: Spherical Harmonics

#29
post #20
post #19

Earlier quoted context omitted.

Yes. These are solutions of the Schrodinger equation for the electron in the hydrogen atom.

Aren’t the spherical harmonics functions with domain S^2, the sphere? I think the solutions to the (time-independent) Schrödinger equation for an electron in a hydrogen atom are given by like, a product of a function of distance from the center with one of the spherical harmonics, or something like that?

you are correct. The Schrödinger equation for the hydrogen atoms in spherical coordinates demonstrates separability which allows you to separate the radial and angular coordinates. The radial term, which is most interesting due to the 1/r potential is typically a Laguerre polynomial. The angular term is 'free' from any potential is typically a spherical harmonic.

The spherical harmonics in general are typically derived as part of the solution to the Laplace equation in spherical coordinates. A bit of a semantic point (though perhaps the distinction is important) though, since the Laplace equation's angular dependence is identical to that of the Schrödinger equation for the hydrogen atom.

Post reply on HN