# Light-scattering integral

This topic is 5234 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello! I've been reading and reading and reading any number of papers on advanced lighting and shading with regards to light-scattering (Harris, Dobashi, Nishita.. The big guns), but I keep getting hung up on actually implementing an algorithm for solving the integral(s) and, really, the whole system in some cases. I was wondering what data, in the case of multiple-scattering, is typically pre-computed and stored in look-up tables, what data is generated in real-time through discrete numerical integration, and what algorithms are commonly used for doing numerical integration at discrete points on the CPU/GPU? Overall, I suppose I'm asking what methods are available for solving these systems. Thanks! Chris Millward

##### Share on other sites
I've made several experiments trying to store scattering information FOR A WHOLE PLANET in a lookup table.
I ended up with the conclusion that the extinction part (the fraction of light that leaves the ray from object to eye) can be stored in a 3D table (possibly 2D).
The inscatter part (the light that is added to the light in the ray object-eye) depends also on the sun position, giving 2 more degrees of freedom in my case, so that's 5 dimensions! Too much!

Anyway, if you just want light scattering for low altitudes (say, <5000m), things simplyfy a lot. You should be able to store everything in a 2D table then, I guess.

##### Share on other sites
I think you can do something by mixing the CPU and the GPU. Some parameters of extinction/inscattering are dependant on your position on the planet. As such, you can make a texture assuming these parameters are constants for your current position, and recompute the lookup textures on-the-fly when your position on the planet has changed too much.

I haven't tried to implement it (yet) though. It might also be an issue if your camera moves too fast (like going from one point of the planet to another in one second).

If your lookup textures are 256x256, updating them in pseudo-real-time should not cost too much.

Y.

##### Share on other sites
It depends if you want this for a real-time application in a scanline renderer or on off-line application such as a ray-tracer. In isotropic materials, you can approximate multiple scattering using something called the Dipole Diffusion approximation (see both of Jensen's papers on subsurface scattering). This can be done quickly if you use a heirarchical structure like a kd-tree or octree to cache irradiance samples. There are also techniques like ray marching and photon marching that can be used to solve single or multiple scattering. Just google for them to find out more.

##### Share on other sites
I haven't done any work on realtime light scattering but I think this paper looks good. The multiple scattering is simulated by changing and tweaking different parameters of the extinction and phase functions.

I am currently implementing a NON realtime renderer/simulator for the atmosphere using a wavelength based path tracer.

Multiple scattering I think depends on if you are rendering clouds or the sky. I am currently implementing second order scattering as described in the paper from Nishita from 1996! We'll see how it turns out.

In general I think it's quite hard for "programmers" to make sense of all these papers on atmospheric scattering, I've read lot's of them and it took some time to get the hang of it :-) And multiple scattering is usually just briefly mentioned.

Good luck.

##### Share on other sites
Thanks for replying, everyone!

AP, that paper is huge, I can't wait to get into it (probably shouldn't print all 134 pages at work, I'll have to wait until tonight :( )

Chris Millward

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 30
• 9
• 16
• 22