Jump to content

  • Log In with Google      Sign In   
  • Create Account


Spherical Harmonics - Sphere maps, cube maps and user interaction


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 opengl_beginner   Members   -  Reputation: 106

Like
0Likes
Like

Posted 28 October 2012 - 01:24 PM

Hi guys! Posted Image


This is my very first post on this forum Posted Image


I'm very much new to OpenGL and I'm currently starting my newest adventure in this field - Spherical Harmonics.
The idea I would like to implement it the following:

A user interface (OpenGL or MATLAB), which displays an illumination model and a scene containing synthetic objects.
The user gets to rotate/move/play around with the illumination model and, as a result, the image is rendered under the chosen illumination.



I have read through quite a few previous posts on this topic and googled the web (this is the most relevant project page: Link), but there are still a few open questions.

1) What is the interpretation of a spherical harmonic model - it models the incoming light for each pixel on the surface, i.e. irradiance. And rendering is done based on the outgoing lighting power, i.e. radiance. Is this correct?

2) SH are said to be good for image with only low-frequency components. Why so? Could anyone provide with an example image, which is NOT suitable for SH modeling?

3) Spherical harmonics can be represented using cube maps or spheres. What is the difference - is one representation better than the other? Are there any other options - e.g. triangles, octaeders, ellipses, etc.?

4) Light probes can be used as environments maps (Link). Are there any other options?

5) I came across an excellent tutorial by Robin Green (Link). I also found a nice implementation of it, which I would like to edit: Link
Unfortunately though, I am not quite sure how/where to get started.
Any suggestions?


Looking forward to your response! Posted Image

Edited by opengl_beginner, 28 October 2012 - 01:25 PM.


Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 6735

Like
0Likes
Like

Posted 29 October 2012 - 01:35 AM

In short, sperical harmonics are way to compress incoming light. A very simple spherical harmonic would be a vector and a cone (4 parameters) which could be used to tell from which direction light up to a certain angle (cone) is coming. The vector AO version is therefore more or less a spherical harmonic, but the issue is, that it can only describe the incoming light from a single direction.

Now, you can increase the accuracy of this by increasing the resolution of a spherical harmonic and this is memory intensive (+more arithmetic). So, if you want to keep it at a sane level (i.e 9 parameters) you only have a resolution which can handle low-frequency distribution of incoming light in a satisfying way.

Taking a cube map into account you could map the incoming light on this cube map instead of a sphere, which would give you an incredible resolution (=light probe).

The issue is now the task you want to solve. A single spherical harmonic at a single point saved as cube map is a great way to adjust the lighting of a character etc. but for global illumination you want it for each texel, much like AO. Simple precalculated AO has only a value of 1 byte, a 9 component SH with 16bit floats has 18x memory consumption of a simple AO term which is quite heavy.

Hope it helps you to get a better feeling for SH.

Edited by Ashaman73, 29 October 2012 - 01:38 AM.


#3 opengl_beginner   Members   -  Reputation: 106

Like
0Likes
Like

Posted 29 October 2012 - 05:43 AM

Hey Ashaman!


I think I understand it better everytime I discuss it.
It'll become even better when I start writing code for it.

I would like to start the following way:

Display arbitrary objects (cubes, spheres, rings, ellipses, etc.) in a scene and have them rendered using SH.
Any ideas on how I should start?

Thanks!

#4 Ashaman73   Crossbones+   -  Reputation: 6735

Like
0Likes
Like

Posted 30 October 2012 - 12:51 AM

Display arbitrary objects (cubes, spheres, rings, ellipses, etc.) in a scene and have them rendered using SH.
Any ideas on how I should start?

I'm not sure if you really understand what SHs are. The are a mathematically construct like vectors. So, you are asking how to renderer a cube using vectors ?

What is your goal ? SH are often used in lighting calculation, but there are really many options how to use them. AO like terms, light maps, light probes, LVP, these are different techniques which uses SHs and vectors, so where do you want to start ?

#5 opengl_beginner   Members   -  Reputation: 106

Like
0Likes
Like

Posted 30 October 2012 - 01:05 AM

Hi again!

This project shows what I would like to do: http://www.yasrt.org/shlighting/

These are the steps I have been thinking of:
1) Compute SH coefficients for different light probes (e.g. Grace Cathedrale)
2) Generate a sphere, which represents the SH illumination model
3) Create a 3D object (e.g. aring)
4) Fix albedo = 1
5) Rendering the ring under Grace Cathedrale illumination
6) Rotate SH model, and as a result, the scene should change in real-time

I've managed to carry out step 1) using the prefilter.c function given here.
Now - how do I create a sphere that represents the model (similar to aforementioned project)?

Thanks!

#6 Ashaman73   Crossbones+   -  Reputation: 6735

Like
0Likes
Like

Posted 31 October 2012 - 01:36 AM

These are the steps I have been thinking of:
1) Compute SH coefficients for different light probes (e.g. Grace Cathedrale)
2) Generate a sphere, which represents the SH illumination model
3) Create a 3D object (e.g. aring)
4) Fix albedo = 1
5) Rendering the ring under Grace Cathedrale illumination
6) Rotate SH model, and as a result, the scene should change in real-time

This sounds more like homework then musing about a technique Posted Image

Nevertheless, the webpage you posted got a lot of links, including links to source code and books. I can't explain spherical harmonics myself beyond what I've written, so best to get the book from the library Posted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS