Sign in to follow this  
maya18222

GI, Sphereical Harmonics and Final Gather

Recommended Posts

maya18222    194
I was just wondering if someone could clear up these definitions i have of the following rendering methods, as to whether i have them right or wrong. Spherical Harmonics - The process of summing up 3 rendering stages, that is, basic diffuse shading (N.L) for indirect lighting (no lights are defined), the self shadowing visibility term, and finally the reflected light off of other objects. From what i gather, this process cannot create shadows in the scene from other objects or itself, as it is a pre-calculation stage, and used mainly on static objects. To use it with animated objects, you have to calculate the whole equation for each point in time and store it, interpolating between these values when animating. Global Illumination - The process of simulating the physically correct simulation of light bouncing around a scene that originates from one or many defined light sources. No indirect lighting or bleeding stages are added as the indirect lighting comes with the fact that the light has bounced around the room so many times, it reaches locations that direct lighting techniques would not affect. Shadows come free. Final Gather - The process of lighting a scene where no actual light objects are defined. The actual light rays are found from an enviroment map, where each texel in that map is shot as a ray through the scene, and bounced around as does GI. As with GI, indirect lighting and bleeding is already calculated, so do not need to be added. Shadows come free. Im not sure how you would use this method dynamicly as the light properties are baked into the enviroment map. Is it only used for static lights? Ray Tracing - The process used by all the above to shoot rays though a scene, with an original colour and direction. The colour changes as it makes each bounce, multiplying itself with the reflected colour off the intersected object. How many times the ray can bounce and how many rays created is defined by the artist. Where more is usally better/more accurate but more costly. Im not sure about photon mapping. How do Spherical Harmonics differ from Ambient Occusion, other than the final stage of summing bounce lighting?

Share this post


Link to post
Share on other sites
Shirakana2    500
I think you misunderstand some concepts. Let me try to clear that:

Global Illumination (GI): not a process nor a method, but just a set of visual effects / features we want to have to get a realistic image. It is composed of different effects such as indirect lighting, color bleeding, subsurface scattering, caustics, indirect shadows...

There are several methods to approximate GI for a scene, and none are covering all GI features (very basic description):

- Path tracing (or Ray tracing): shooting rays from the eye to the scene and compute bouncing and material contribution.

- Radiosity: three steps algorithm. Divide all your scene surfaces into patch, then compute each radiance exchange between all couple of patches. Use final gather for rendering.

- Photon mapping: two steps algorithm: shoot photons from light sources, each bounce on geometry create a new set of photon, etc... Store all photons information in a data structure. Use final gather for rendering

- Photon tracing: basically same as photon mapping but photons are shot from the eye

- Final gather: method to compute final image using lighting data structure. For example using photon mapping, for each point, interpolate the illumination from the photons that are close to the point.

- Ambient occlusion: a very crude approximation for computing a global ambient term for each point, based on surrounding geometry

-----

Spherical harmonics (SH): IS NOT A METHOD, but a mathematical tool you can use to compress and compute illumination data. The most famous technique that use SH is Precomputed Radiance Transfer, where, for each vertex you compute GI using one of the method above, and compress and store this result using SH. For rendering, just use the SH coeficient you precomputed before and calculate your final color.

I think you can google each of the keywords and fine some nice tutorial explaining all in details

Share this post


Link to post
Share on other sites
Yann L    1802
A few notes:

SH

Spherical Harmonics are a mathematical model, which can be used to represent the incoming light over a sphere or hemisphere. It's essentially an encoding or compression technique that captures light from all directions at a point P (the irradiance at that point), and stores it in a compact and easily manipulatable way. It is conceptually similar to a cubemap, but it offers the advantage of lower memory requirements, and has a few mathematical perks when it comes to combining two or more SH together.

Mathematically, SHs can encode a signal of any complexity, however this would require an infinite number of harmonic coefficients. In practice, only lower order SHs are used, so that the represented signal can only contain low frequency data. This is fine for irradiance data (which by definition is a low frequency integral), but it doesn't work for high frequency signals, eg. speculars.

SHs can be used to store the lighting data provided by several GI computation techniques. It's not fixed to one specific technique.

Final gather

Final gather is not a GI method by itself, but an algorithm used to derive a high quality GI solution through probabilistic means, without introducing too much noise. It is generally used in conjunction with other probabilistic methods. It cannot usually work on its own.

A typical example is a Monte Carlo based stochastic radiosity solver, which roughly works this way:

First, all direct lights distribute their energy onto the surrounding surfaces. This is called the "direct shooting" pass. It typically uses a basic raytracing approach.

Second, an irradiance map is created from the direct light data. This step is a slightly modified progressive refinement radiosity solver. You take the highest energy (differential area) patch, and shoot its energy randomly into the environment. You repeat until most of the energy is distributed. The performance of this process can be increased by shooting multiple patches simultaneously, by introducing multi-resolution patches, etc.

The above process alone could already generate a usable GI solution. However the stochastic shooting process introduces a lot of noise. So it would have to run for a very long time in order to produce a clean result. That's where final gather comes in.

The idea of final gather is to add an additional gathering pass to the solver. Each patch will trace a number of random rays, and sample the (noisy) irradiance map created above. This method, called gathering, will approximately solve the irradiance integral for each patch. As I mentioned above, this integral is low frequency. So even though the sampled irradiance map is noisy (ie. it contains high frequency artifacts), the gathering operation will smooth it out. This property allows you to run a rather coarse (and as such less time consuming) radiosity shooting pass, while still getting a smooth result from the final gather pass.

I hope this clears up a few things :)

Share this post


Link to post
Share on other sites
maya18222    194
Hmm, thanks for this guys.

So are you saying that Final Gather is just algorithm that samples random points and averages them out to create a smooth result?

And when you say noise, do you mean this?

SH still make no sense to me atm, ive tried reading many papers on them and dont really get anywhere. If you're capturing the light from all directions at some point, wouldn't that just mean that the point is always fully lit, provided at least one light exists?

When using it, do you define any lights? else how does it know about the colour and properties of the light? Also wouldnt having more scene lights also mean there would be more indirect light? so in that case, wouldnt you have to know about the scene lights?

I will keep reading about it, hopefully it will make sense at some point

Share this post


Link to post
Share on other sites
Yann L    1802
Quote:
Original post by maya18222
So are you saying that Final Gather is just algorithm that samples random points and averages them out to create a smooth result?

It's a bit more than just averaging. You need to send out rays that follow a specific probabilistic distribution. You want to compute (well, approximate) the hemispherical integral, not just an average value. And then, it's not really random either. It's usually a Hammersley or Halton sequence, adjusted for a cosine stochastic distribution. See the Monte Carlo method for more info.

Quote:
Original post by maya18222
And when you say noise, do you mean this?

Yes, for example.

Quote:
Original post by maya18222
SH still make no sense to me atm, ive tried reading many papers on them and dont really get anywhere. If you're capturing the light from all directions at some point, wouldn't that just mean that the point is always fully lit, provided at least one light exists?

The idea is to be able to query the incoming light for any direction at runtime. For example, you have a point lit with a green light from the right, and a red light from the left. After encoding as a SH, your shader can query in realtime the light colour coming in from a specific direction. For example, when querying the left direction (with an appropriate direction vector), then the SH would return a shade of red, while a vector facing right-wards would return a greenish tone. In other words, an SH contains all colours from all directions simultaneously. It's like a cubemap, only much smaller.

Quote:

When using it, do you define any lights? else how does it know about the colour and properties of the light? Also wouldnt having more scene lights also mean there would be more indirect light? so in that case, wouldnt you have to know about the scene lights?

Of course everything starts with lights that you have to define. That would be the sun, the sky, artificial lightsources of all kinds, etc. The basic approach is to first compute a GI solution from all these lights using your favourite GI solving algorithm (adding indirect lighting in the process), and encode the final result as spherical harmonics. More advanced approaches will encode different components (skylight, direct light, indirect light, etc) in separate SH probes, so to allow more sophisticated lighting effects.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this