# O'Neil Atmospheric scattering scale function

## Recommended Posts

Hey all,

I have implemented O'Neils atmospheric scattering from space as described in GPU Gems 2. I have got it working the way I want except that I having trouble making the atmosphere larger/bigger. O'Neils implementation uses a predefined scale function which limits the atmosphere to be 2.5% larger than the planet itself. Currently this is what I have:

What I want to achieve is a larger atmosphere, as seen in Spore for instance:

[img]http://www.freewebs.com/danielsblog/Spore%20Planet.jpg[/img]

It is obvious that in the screenshot above the atmosphere is much larger than 2.5% of the planet..

So my question is: how to adapt O'Neil atmospheric scattering approach to account for a larger atmosphere.

##### Share on other sites
Somewhere in your shaders , you should adapt the exponentials : exp(-h/H) h = your altitude , H = the height where the considered quantity is the highest concentrated for example there are two values : one for mie scattering and one for rayleigh scattering.

If you simply integrate the shaders as they are provided in Gpu Gems2 in your renderer , try to find the constants that are used in the denominator of the previous exponentials...
You can put what you want in it if you stay in the same coordinate range in the full pipeline of calculation.

Oh and just to comment the pic of spore, there is no atm scattering in there...

##### Share on other sites
[quote name='boubi' timestamp='1305669717' post='4812119']
Oh and just to comment the pic of spore, there is no atm scattering in there...

[/quote]

Thats very interesting, what I want to achieve is more of a 'spore-like' planet than a correct solution. Can you maybe provide me with more information on how the sky in spore is rendered?

##### Share on other sites
[quote name='Bas Zalmstra' timestamp='1305670012' post='4812121']
[quote name='boubi' timestamp='1305669717' post='4812119']
Oh and just to comment the pic of spore, there is no atm scattering in there...

[/quote]

Thats very interesting, what I want to achieve is more of a 'spore-like' planet than a correct solution. Can you maybe provide me with more information on how the sky in spore is rendered?

[/quote]

From what i see i guess they render a second sphere with alpha blending , and modulate alpha by dot(N,L) L being sundir and N sphere normal...

##### Share on other sites
You might find this interesting:

There's also some newer posting on the same blog that you might find useful.

##### Share on other sites
[quote name='PolyVox' timestamp='1305674625' post='4812154']
You might find this interesting:

There's also some newer posting on the same blog that you might find useful.
[/quote]
Thanks that is very useful indeed!

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628349
• Total Posts
2982210

• 10
• 9
• 24
• 11
• 9