Sign in to follow this  
Patrik Svensson

Multiple scattering in atmospheric rendering

Recommended Posts

I have implemented an atmospheric rendering algorithm using both Rayleigh and Mie scattering. (Non realtime) The problem is that I only implement single scattering. Using single scattering you don't get the correct colors for the horizon. Especially when the sun is high in the sky. And the sky is too dark when the sun is low at sunset. Many of the papers out there claims to implement multiple scattering but none of them describes in detail how this is done. I use a kind of raytracer/pathtracer to calculate the color of the sky. Can someone suggest some possibilities on how to implement multiple scattering. Cheers,

Share this post


Link to post
Share on other sites
I tried the method described in "Display Method of the Sky Color Taking into Account Multiple Scattering" some time ago. You might've read that one. I ended up using just single-scattering and it looked fine for me. The multiple-scattering ended up being a pain and didn't seem to look any better - I don't really recall how I did it (other than I followed that paper) which isn't much help to you. I was pretty happy with single-scattering and did multiple-scattering to try to get the sunset to blend into night sky better. I ended up ditching multiple-scattering and simply tweaking a few parameters in the single-scattering to get the night-day transition to look pretty good - also generated sky alot quicker without multiple-scattering. Multiple scattering is better for more optically dense media like clouds - for the atmosphere it really is a 2nd order effect that can be achieved by fudging the single-scattering a little bit as described below...

Summary of what I did... ended up doing single-scattering at about 4 or more uniformly spaced wavelengths in the visible range, then converting that to CIE XYZ (using colour matching functions) and then (and this made a big difference) multiplying the XYZ 3-vector by (Y^0.333)/Y to brighten up the sky (so you don't get a bright sun in the middle of a dark sky), then convert to RGB for display. Getting reasonable images was then a matter of finding the right parameters (rayleigh, mie, applying weights to each wavelength, etc).

I've got some shots up at http://home.pacific.net.au/~linmeijohn/Skyshots.jpg

Share this post


Link to post
Share on other sites
Your best option is to look into photon mapping. Jensen has some great resources for doing multiple scattering; if you are familiar with the photon mapping concept, this paper should provide all you need to get multiple scattering going. If you aren't comfortable with photon mapping, Jensen's other papers have all the important stuff, but be warned, it can take some time to filter through it all and get at what you need. If you want to put out the cash, I very strongly recommend you pick up his book as well.

Share this post


Link to post
Share on other sites
Thank you,

First, Soiled your images looks about the same as mine. So I think wont be able to improve on the single scattering much more.
The images are still not quite correct for the sunset, the sky is way to dark compared to real life. The sky is actually very light blue quite some time after the sun set, this can only be simulated correctly with multiple scattering.

Second, thanks ApochPiQ. Photon mapping is the way I was planning to go. I have all the Jensen books and papers and I figured this was the best approach. I just wanted to see if someone had some other suggestions. I'm thinking of emmiting photons from the sun and letting them scatter once to get second order scattering. Then for each of my integration events I check the KD-tree to incorporate the indirect lightning. Do you have any more suggestions in morer detail of what I need to think about?

Thanks,
Patrik

Share this post


Link to post
Share on other sites
Quote:
Original post by Patrik Svensson
The images are still not quite correct for the sunset, the sky is way to dark compared to real life. The sky is actually very light blue quite some time after the sun set, this can only be simulated correctly with multiple scattering.

That's exactly what I thought and what made me decide to try multiple-scattering, but alas it didn't help. My sky is only used in an action game so I decided it's good enough (and with clouds it's even less noticeable). Perhaps changing the 0.333 factor in (Y^0.333)/Y as the suns sets might help lighten up the sky at sunset. And if sky colour (the part that's supposed to be light blue) at sunset is not right then perhaps changing the sun spectrum (the wavelength weights) as the sun sets might help (or just change it for the rayleigh part of the calculations) - may or may not work - may also change the reddish sunset colour adversely. Anyways, good luck.

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