Howdy folks,
Over the weekend I found out just how hard it is for a not overly mathematical person to make heads or tails of the atmospheric scattering maths in research papers. I also found out how hard it is to find working example code (Java or otherwise) that shows even the most basic scattering equations working.
So, I present to you, an implementation of the GPU version of Sean Oneill’s atmospheric scattering.
http://pastebin.java-gaming.org/75c4464703b
I don’t promise that the code is pretty, or very well written, but it works (and there are sunsets).
Notes:
- It uses LWJGL
- There are magic numbers I haven’t quite figured out yet
Cheers,
Brett
Edit (Added PAMD code links from this post):
Simple (and slow) BufferedImage implementation of “Practical Analytic Model for Daylight”
https://docs.google.com/folder/d/0Bw97A7hoqbmPcGpVNEd6UnprSms/edit
Libgdx based shader implementation of “Practical Analytic Model for Daylight”
https://docs.google.com/folder/d/0Bw97A7hoqbmPcGpVNEd6UnprSms/edit