YAAS - Yet Another Atmospheric Scattering thing

Could you share your new code that made it work like this?

Agreed. If the changes are relatively simple, I’d love to incorporate them into the open source version.

I’m also currently working on creating a plugin that is a mix of this and SkyControl, and I would like to use this updated code.

Hi

the changes are relative simple. First I took pspeeds code and compared it to Sean O’Neils source code.
After that I studied (papers, other implementations) the algorithm several hours and implemented my own (more sean) version.
But these are the important changes:

  • used two TruncatedDomes and rotate the second one by PI (180°), because JME Sphere doesn’t work well.
  • merged the two domes to one mesh with GeometryBatchFactory.mergeGeometries(geoms, outMesh);
    btw @pspeed is there something you can do so create a sphere at once with your code?
  • in the vertex shader: limited the view angle to prevent negative values and artifacts
  • in the fragment shader: calculated fCos with sun direction and back direction divided by the NEGATIVE back direction

these are the few main steps. The shader was extended by some tonemapping and a night sky :smile:
My code is not finished. I can share it with you as soon as I cleaned my code. pspeed has some nice improvements to save some shader instructions. I would love to this shader in the offical JME. It’s a must have feature!

Is there something I can do to prevent the color stripes, you can see in the video, and to get a more reddish sun rise/set?

1 Like

Interesting. What parts of sky control are you using?

I felt like this one worked well on its own… but I would think that. :slight_smile:

I’m not using that much from it yet. I’m just trying to get your atmospheric scattering implementation fit as a plug and play realistic day/night system for my games and others games. I don’t know how I will have a star field in it, I’m currently doing research on how some unity plugins do that. Maybe even a weather system based on the volumetric clouds project that someone posted a while back. I I’m not that great of graphics programmer, just tinkering with it and stuff.

Cool, yeah.

Personally, I would do stars as a separate AppState… and clouds, too. These are both on my to-do list for the future.

I think for stars you could also use a standard JME sky with a starfield sky map and the current shader will work. I half-remember that black is really just transparent but I could be misremembering.

I will look into it. If it is, I could just have a starfield skybox fade in and out during sunsets and sunrises… I will have to do some sky research to find appropriate timings to do that.

Honestly my favorite part about this project has been learning about the underlying scientific concepts regarding stars, earth rotation, light scattering, etc…

Well, like in real life, you could potentially leave the star field up all the time as the main sky will fade in and out realistically on its own. In the day time, stars wouldn’t be visible.

Heres what Id ideally like to achieve: