Atmospheric Scattering

Started by
6 comments, last by jcabeleira 14 years, 2 months ago
I want to add atmospheric scattering to my application. The article by O'Neil (gpugems2) mentions a method by Hoffman and Preetham (Hoff) and says:
Quote: This implementation produces an attractive scattering effect that is very fast on DirectX 8.0 shaders. Unfortunately, it doesn't always produce very accurate results, and it doesn't work well for a flight or space simulator, in which the camera can be located in space or very high above the ground.
Does anyone have any experience with this? In my application the camera is not in space and it is not a flight simulator. The player might be elevated on a mountain though. I would like to know if the Hoffman and Preetham approach is better suited for me, or if O'Neil's method is much improved? Has anyone implemented both?
-----Quat
Advertisement
Hi there,

There is another atmospheric scattering method from Eric Brunton which performs multiple scattering and can be implemented for any height level. You can google his paper for more detail. He also has a demo with source so you can implement it. Good luck.
Quote:Original post by b_thangvn
Hi there,

There is another atmospheric scattering method from Eric Brunton which performs multiple scattering and can be implemented for any height level. You can google his paper for more detail. He also has a demo with source so you can implement it. Good luck.


I got interested by this and tried to find this paper. That proved to be more difficult then I expected. The only reference I found to the name "Eric Brunton" in an atmospheric scattering context was on a blog by someone ( presumably you considering the name :) ), who had implemented scattering based on his method.

If you have a link to this paper I would appreciate it.
I think it's spelt Bruneton
Quote:Original post by Hodgman
I think it's spelt Bruneton
More specifically, this is his home page, and his group demonstrated their technique in this image of the day.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Thanks for the replies. But do you think the method by Bruneton is needed if you do not go high in the sky or in space? Basically, I'm trying to see if the Hoffman method is enough for my situation, and I don't have a lot of time to implement multiple algorithms.
-----Quat
Hi,

Take a look at my implementation:



It's written using dx9 and hlsl. If you use dx10 it's even easier. Bruneton's demo is great cause it provides you with all the source. So sorry for the miss spelling.

Anyway, if you decide to choose Bruneton approach, I can help you out with it. I don't know much about the other implementation, but I'm sure many ppl here have done it.

P.S: Does anyone know how to embed youtube video straight in the post? Thanks.
Quote:Original post by Quat
I want to add atmospheric scattering to my application. The article by O'Neil (gpugems2) mentions a method by Hoffman and Preetham (Hoff) and says:

Quote:
This implementation produces an attractive scattering effect that is very fast on DirectX 8.0 shaders. Unfortunately, it doesn't always produce very accurate results, and it doesn't work well for a flight or space simulator, in which the camera can be located in space or very high above the ground.


Does anyone have any experience with this? In my application the camera is not in space and it is not a flight simulator. The player might be elevated on a mountain though. I would like to know if the Hoffman and Preetham approach is better suited for me, or if O'Neil's method is much improved? Has anyone implemented both?


I have experience with this subject, I've implemented a atmmospheric scattering algorithm very similar to GPU Gems 2 article and I've read about Preetham's work.

The GPU Gems2 articles is based on the work of a guy called Nishita and generates atmospheric scattering by simulating the behaviour of light while it crosses the atmosphere. This is fully dynamic and real-time and provides very reallistic results. Crysis also used this algorithm, or something very similar, on their skies.

Preetham's model is just a simplification of the previous algorithm. It basically uses a set of precomputed coeficients generated using Nishita's algorithm and fits them into a function that receives parameters, like sun direction and view direction, to generate the sky color for a given time of day.
This model is faster because all the heavy calculations are already preprocessed but it has several disadvantages like being hard to implement (requires some strange subtlelties to interpolate coefficients and transform them to correct units) and assumes that atmosphere as constant density which causes unreallistic results (for example, a mid-day preetham sky looks too dark).
Another big disadvantage of the Preetham's model is that it is only usefull for generating sky color. For aerial perspective effects it as to fallback to the original method of Nishita which is similar to the GPU Gems method.

So, my recommendation is that you use the GPU Gems algorithm because it is reallistic, flexible and (believe it or not) easier to implement.

This topic is closed to new replies.

Advertisement