**0**

# Spherical harmonics in LPV

###
#1
Members - Reputation: **208**

Posted 07 May 2014 - 08:02 AM

###
#2
Crossbones+ - Reputation: **18524**

Posted 07 May 2014 - 09:04 AM

Spherical harmonics are used to represent functions that map directions to real numbers. Another representation of the same type of data is a cube map. In the case of a cube map, you sample the function at certain points in a grid and store those values. In the case of spherical harmonics, you compute certain averages of the function with carefully chosen weights, which allows you to reconstruct the "low-frequency" part of the function. This means that spherical harmonics will be good at expressing rough ideas about where light is coming from, and they can do this with very few numbers, which is why they are appealing. But don't expect any high-resolution sharp details to be preserved.

The paragraph above is not specific to your situation, but perhaps it will help you understand it.

###
#3
Moderators - Reputation: **11428**

Posted 07 May 2014 - 09:36 AM

This is the classic paper on SH Lighting: http://www.cs.columbia.edu/~cs4162/slides/spherical-harmonic-lighting.pdf

Definitely go through that.

###
#4
Members - Reputation: **771**

Posted 07 May 2014 - 01:09 PM

Hey guys I have a question about how Light propagation volumes works.Iam not shure what the function of spherical harmonics is because I dont understand what and what for it actually is. Can somebody explain what it is used for ? And also Iam wondering how the Volumen texture of "light" is aligned back to the geometry. Sorry Iam not very advanced in math because of my age.thanks

To add to the previous answers: In the context of LPV, they are used to not only store the "power" of the light in a cell of the volume, but also the general direction its moving in. SH is mainly used for this because it's way cheaper in terms of required memory and processing power than (as a "full retard" example) storing a list of directions and intensities of each source of "light" that moves through the cell. For this the algorithm uses three 3D textures (one for RGB of light intensity each) where each texel of the texture stores 4 SH coefficients (coefficient = just a number) in the xyz and w components. How they are computed and used is explained in the paper linked above, but don't worry if it takes you a while to understand. I didn't wrap my head around it until a month or so after I first read the paper. But beware that calculus is essential to understanding them, I don't know if that will be a problem since you mentioned your age.

I implemented a version of the algorithm for my bachelor thesis. Maybe the short explanation of the algorithm and spherical harmonics given in there are helpful to you. You can find it here.

**Edited by agleed, 07 May 2014 - 01:23 PM.**

###
#5
Members - Reputation: **208**

Posted 07 May 2014 - 01:20 PM

Hmm thanks for the answers now I got a better view on that stuff but some parts are still to difficult for me. In the paper above (http://www.cs.columbia.edu/~cs4162/slides/spherical-harmonic-lighting.pdf) I don't understand the stuff after the Monte Carlo Estimator. So you said SH "generates" a function that gives back in average the vectors for some input numbers ? And this is done by grabing some Basicfunctions ( I guess they are called coeffecients there ?? ) to store vectors for sphercial coordiates ??

This reminds me to the hash tables where you have a hash function that gives you a position and thus the content for an input number.

But as I understand SH is only used to save memory. But how LPV would work withozt that Iam not shure how the principle works. I always think about a Volume texture in 3D space where the Start Lightpoints are registered via the RSM and then spread with each LPV iteration through the volume and then get sampled back to the geometry.....

I do not undersdtand that maybe someone can explain it better and particularly the sense of this Geometry Volume.

Thanks

PS:agleed thanks for your explanation, one question are you german ? Because I live in Germany and it would be very nice when you could write in german

**Edited by StanIAm, 07 May 2014 - 01:38 PM.**