Jump to content
  • Advertisement
Sign in to follow this  
Dev_NightDreamer

OpenGL Atmospheric Scattering

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone,

 

there's something special I want to implement, but that I can't understand: atmospheric scattering.

My goal is, to achieve a sky background, where I can adjust the color gradients/etc. parameters.

 

Therefore I googled and found a lot of interesting stuff: Sean O'Neills GPU Gems 2 - accurate atmospheric scattering.

1. Question) Why is everything I found regarding the implementation stuff from before 2012?

 

Now I had a problem: the shader described is only the SkyFromSpace shader.

This was fixed, after I found the link to the download section.

 

Then there came up another problem: almost everyone got the tip: visit his website and download the improved version.

2. Question) How should I visit Sean O'Neills old website, if the website is now a website for casinos?

 

TLDR:

Have anyone an idea how to get the source for Sean O'Neills implementation 'SkyFromAtmosphere' in OpenGL?

Or better: an actual tutorial for atmospheric scattering?

Or is there something better these days? (<- that's why everything is from before 2012?)

 

Thanks in advance,

NightDreamer

Edited by N1ghtDr34m3r

Share this post


Link to post
Share on other sites
Advertisement

Therefore I googled and found a lot of interesting stuff: Sean O'Neills GPU Gems 2 - accurate atmospheric scattering.
1. Question) Why is everything I found regarding the implementation stuff from before 2012?

Sean's been out of the planet rendering game for a while before that (largely due to time pressure). I used to correspond with him back in 2009'ish, haven't done so in recent years.
 

Then there came up another problem: almost everyone got the tip: visit his website and download the improved version.
2. Question) How should I visit Sean O'Neills old website, if the website is now a website for casinos?

His website went offline a few years ago. Luckily, a ton of people incorporated his shaders into their projects, any many of those are hosted on GitHub. Try this one for size.
 

Or is there something better these days? (<- that's why everything is from before 2012?)

Yes, actually, there are a couple of other options, depending on what you are looking for.

The absolute state-of-the-art is Eric Bruneton's work on atmospheric rendering. He has implemented a much more complete scattering model, which looks absolutely gorgeous, though the implementation is a tad more complex.

 

If you want a cheaper approximation of scattering (maybe for a mobile game), then Alex Peterson did a very credible job of faking it via texture lookup. I've implemented these before, and they look pretty damn good for the ease of use and performance.

Share this post


Link to post
Share on other sites

Hello swiftcoder,

 

thank you for replying. That makes a lot more clear.

 


Yes, actually, there are a couple of other options, depending on what you are looking for.

The absolute state-of-the-art is Eric Bruneton's work on atmospheric rendering. He has implemented a much more complete scattering model, which looks absolutely gorgeous, though the implementation is a tad more complex.
 
If you want a cheaper approximation of scattering (maybe for a mobile game), then Alex Peterson did a very credible job of faking it via texture lookup. I've implemented these before, and they look pretty damn good for the ease of use and performance.

 

I think Eric Bruneton's work (which looks indeed extremely awesome) isn't a good solution for a game, isn't it?

And the second approach from Alex Peterson shows only the perspective from the sky.

In my use case it would be rendered to a screen filling quad to be the background sky in a game with day/night cycles. :)

Share this post


Link to post
Share on other sites


I think Eric Bruneton's work (which looks indeed extremely awesome) isn't a good solution for a game, isn't it?

That depends on you target hardware. Maybe not a good solution for mobile, but it's very achievable for a PC game.

 

Keep in mind that he developed the technique back in 2008 - it ran on consumer hardware back then, and we've now had 7 years of GPU development on top of that.

 


And the second approach from Alex Peterson shows only the perspective from the sky.

Alex's shaders work fine from the ground too - take a look at the video in his earlier blog post. I use them for seamless ground->space transitions, and they work fine with some minor tweaks to their alpha transparency.

Share this post


Link to post
Share on other sites

That depends on you target hardware. Maybe not a good solution for mobile, but it's very achievable for a PC game.
 
Keep in mind that he developed the technique back in 2008 - it ran on consumer hardware back then, and we've now had 7 years of GPU development on top of that.

 

Okay, that's a good point. Although I'm developing on a GTX980Ti. smile.png

 

I'll try Eric Bruneton's approach first. If I got problems, I will ask again and/or try Alex Peterson's (btw: I'm aboslutely a fan of his program Spacescape)

Unfortunately I couldn't get his sample project/code working.

I've made a new VS2013 project, copied all his files, included GLEW and Glut but can't find the library/headers for "tiffio.h"...

 

EDIT:

Also (if I commented all the texture loading stuff out) the linker complains about missing functions in glut, which can't be the case, due to the fact, that I'm successfully linking to the glut.lib and including the glut.h

Edited by N1ghtDr34m3r

Share this post


Link to post
Share on other sites

i believe Rayleigh(sp?) in-scattering is the specific effect you want.

 

Yep, Rayleigh scattering in interaction with Mie scattering, like Sean and Eric (and almost everyone I read about) used, if I understood that correctly. smile.png

 

EDIT:
I realised, that Eric used 4-5 shader programs in his demo. Are they all needed? Or is only one program for the sky?

Edited by N1ghtDr34m3r

Share this post


Link to post
Share on other sites


I realised, that Eric used 4-5 shader programs in his demo. Are they all needed? Or is only one program for the sky?


I suggest you actually look into the fundamentals of atmosphere scattering before delving into actually implementation as you are most likely going to confuse yourself and eventually get discourage. The principles/basis behind atmospheric scattering is the same across implementation since they are based ( some more loosely than others ), on the actual physical laws governing scattering in a participating medium.


I realised, that Eric used 4-5 shader programs in his demo. Are they all needed? Or is only one program for the sky?


This goes back to what I initially said.. Yes all the programs are required as they are use in the pre-computation phase to generate the scattering tables.
 

Share this post


Link to post
Share on other sites


I suggest you actually look into the fundamentals of atmosphere scattering before delving into actually implementation as you are most likely going to confuse yourself and eventually get discourage. The principles/basis behind atmospheric scattering is the same across implementation since they are based ( some more loosely than others ), on the actual physical laws governing scattering in a participating medium.

 

Personally I get way more confused, looking at those publications. :)

I need actual implementations to fully understand things like that.

 


This goes back to what I initially said.. Yes all the programs are required as they are use in the pre-computation phase to generate the scattering tables.

 

Okay. If I understand it correctly, Sean O'Neill wasn't using precomputed scattering tables, was he?

Share this post


Link to post
Share on other sites

Okay. If I understand it correctly, Sean O'Neill wasn't using precomputed scattering tables, was he?

Not the published implementation, no. I believe there was an earlier version that did use a lookup table.

However, keep in mind that he avoided the lookup table by effectively ignoring the other 2 dimensions addressed by Bruneton's 4D lookup table, and heavily quantized the remaining axes, so there is a noticeable reduction in accuracy and fidelity.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!