The Stack Overflow podcast is back! Listen to an interview with our new CEO.
15

Spherical harmonics If you know what a Fourier transform is, you already almost know what spherical harmonics are: they're just a Fourier transform but on a spherical instead of a linear basis. That is, while a Fourier transform is a different way of representing a function $f(x)$, spherical harmonics are the analogous thing for polar functions $f(\theta, \...


10

Basics of Spherical Harmonics Spherical Harmonics is a way to represent a 2D function on a surface of a sphere. Instead of spatial domain (like cubemap), SH is defined in frequency domain with some interesting properties and operations relevant to lighting that can be performed efficiently. With increasing "order" of SH you can represent higher frequencies (...


9

Spherical harmonics really are the "spherical Fourier transform" you're looking for. The kind of hack you mention in comments, of doing a 2D Fourier transform on a lat-long projection, suffers from all the problems you usually have when you try to project a sphere onto a plane: not all spatial relations in the sphere are well-represented in the plane. If you ...


5

Spherical harmonics Let's say you have some data in an array but you want to represent that data with a fewer number of bytes. One way to do that could be to express the data as a function instead of the raw values. You could represent it as a linear function: $y=ax+b$ Then instead of storing your array of values you could store just $a$ and $b$. ...


4

The notation Re() and Im() refer to the real and imaginary parts of a complex number. Mathematicians and physicists are accustomed to using spherical harmonics (and Fourier transforms too) that are complex-valued, due to the factor $e^{im\phi}$. You would then also have complex coefficients, in general, in the spherical harmonic expansion of a (real or ...


3

Spherical harmonics are generally used for dynamic objects in your scene, while fully-baked lighting is used for static objects. A typical game engine will use both. During the GI pass, all surfaces marked as static will have their global lighting fully baked - generally into a lightmap texture rather than per-vertex. At the same time, a bunch of light ...


1

So at start you have samples from your cube map. Each sample has color and normal (dir) at which you sampled that color. This is how I do it. I use coeffs from this paper (the same you linked), there are values for the first 9 of them. So for constructing for each sample you: Compute your SH basis using normal from sample float Y00 = 0.282095; float ...


1

To start I'll assume you have a list of (x,y,z) points each with a r, g, b color that are the samples you want to approximate with the spherical harmonics. To get the coefficients you make a matrix n x 9 $A$ where each row is the sequence $y_0(x,y,z), y_1^{-1}(x,y,z), y_1^{0}(x,y,z), y_1^{1}(x,y,z), y_2^{-2}(x,y,z), y_2^{-1}(x,y,z), y_2^{0}(x,y,z), y_2^{1}(...


Only top voted, non community-wiki answers of a minimum length are eligible