YAAS - Yet Another Atmospheric Scattering thing

@relucri said: Then with Windows 8.1 Intel Flat Shaded uncheked : 160(horizon) , 180 (sky) Flat Shaded checked : 169(horizon) , 174(sky) NVidia gt540M Flat Shaded uncheked : 395(horizon) , 400 (sky) Flat Shaded checked : 399(horizon) , 415(sky)

Consider that the values are approximated . Anyway I played with the setting and I can obtain preatty awesome atmospheres , great great job!

Thanks, you get the windows intel achievement unlocked then. :slight_smile:

I think it’s interesting that the atmospheric shader seems consistently a little faster than Unshaded.j3md. Puzzling and encouraging at the same time. I have some theories and I may have to experiment sometime to see.

I tested it. I get 680-690 fps with it off, looking at the horizon and 660-680fps with it on looking at the horizon.
Windows 8.1, AMD r9 270x, AMD FX 8320, 1080p, 16x AA

nVidia GeForce GT 620.
Windows 7.

Works fine.
I didn’t notice any changes in performance.
Also, this is great work. I can see what it is supposed to do.

Thanks for the additional testing, guys.

Note: this shader and associated parameters code has been added (sometime back) to a new SimFX library that I just haven’t released yet. But the source code is all up in SVN. If there is interest, I can quickly push a library.

https://code.google.com/p/simsilica-tools/source/browse/trunk/#trunk%2FSimFX

It’s pretty easy to use, I think. Add the LightingState (which can be used to take over management of your main directional light) and the SkyState. Voila: sky

Can even be done right in your simple app constructor:
[java]
public class MyGame extends SimpleApplication {


public MyGame() {
super( new LightingState(), new SkyState() );
}
}
[/java]

There is also a built in SkySettingsState if you want to be able to easily pop open a window to edit sky settings.

If anyone is interested, I’ll push up a release.

I’m writing this from my Mac Mini. Yeah, I never get to use it.
It is an intel and NVidia based machine from the 2012 or 2011, I don’t remember specifically when I bought it. But it is as powerful as my windows machine I described earlier in this thread.

It says the quit unexpectedly. Then I get this error. So the program doesn’t run.

[I deleted this error output]

I’m not familiar enough with Macs to know how to interpret that… but if it crashes the JVM without an error than it’s likely a driver bug, I guess. Either that or the hardware just doesn’t support the features selected or something. I assume it crashed after you got past the app settings screen at least?

@pspeed Never mind my past post. I’m updating my software to see what happens. We’ll have to wait though, that puppy is 5Gb in size.

Congratulations @pspeed. It works on my mac mini. No problems at all.

Will you integrate your Atmospheric scattering into SkyControl. It is just a suggestion. I would be awesome though.

@Pixelapp said: Congratulations @pspeed. It works on my mac mini. No problems at all.

Will you integrate your Atmospheric scattering into SkyControl. It is just a suggestion. I would be awesome though.

That would be up to the author of SkyControl, I guess. If I push up a library it should be pretty easy for him to support if he is interested… though it does pull in a few extra dependencies.

I have a question to atmospheric scattering.
These shaders are always applied to a 180° syk dome. Is there a way to render a 360° sphere? Because my scene is not large enough to cover the black lower half of the sky dome :confused:

The atmospheric stuff I did and pushed up to my Sim-FX library has a ground disc also.

Ok thank you. I have copied your code to test your atmospheric scattering shader with the ground disc. But there is not a smooth transition between sky dome and ground disc. Is there a way to fix this? I noticed that your shader code is slightly different to the shader code from Sean O’Neil, but at the end it seems that it doesn’t make a difference how it looks.

screenshot:
http://www.alrik-online.de/alrik/screens/javaw%202015-08-26%2012-28-58-75.png

“fix” is an interesting word since if I go somewhere like the ocean where I can see all the way to the horizon I see an exact horizon line just like this. So perhaps “unfix” is a better word? :smile:

Or if you want fog then you may want to implement fog.

I think the transition is not correct because other implementations looks more smooth.

This guy has other bugs but in the second screenshot you can see a smooth transition:
http://www.gamedev.net/topic/602369-strange-issue-with-sean-oneils-atmospheric-scattering-ground/

This implementation is more what I want. I have no idea whether this implementation is based on Sean O’Neals.
http://threejs.org/examples/#webgl_shaders_sky

…or am I wrong?

I think what you want must be something with more fog?

Here is a google image search of horizons… almost all have a nice crisp horizon line:

https://www.google.com/search?site=&tbm=isch&source=hp&biw=1314&bih=878&q=horizon&oq=horizon&gs_l=img.3..0l10.2171.2803.0.2987.7.6.0.1.1.1.120.530.1j4.5.0....0...1ac.1.64.img..2.5.431.4Qv43AyDa1E

Note: if you use reflective water (like the water post processor filter) then I think you will get a reflection at the horizon which might be closer to what you want. Either way, your “best” picture is entirely inaccurate with real life.

Hm I don’t think the ground shader is correct :confused:
In this thesis (page 69) you can read, that the color of the ground and the sky should be identical.
He also describes the edge as a artifact on page 100.

How high up are you trying to simulate? Because at anywhere near ground level, the notion is patently false as it’s easy to find real world images that clearly show a horizon line. Pages and pages and pages of them.

And if you are traveling up in the sky then you will have to make sure to set the Y offset or the ground won’t look right… but if you’ve got that rigged properly then the ground will fade away to pure haze as you move up.

It’s finally working. I modified the sky shader and now I don’t need the ground disc anymore :smile:
Thank you for helping me as always :blush:

Now I can start to tweak the shader. Have you an idea how can I apply HDR on the atmospheric scattering shader?

screens:
http://alrik-online.de/alrik/screens/javaw%202015-08-28%2002-28-48-68.png
http://alrik-online.de/alrik/screens/javaw%202015-08-28%2002-28-52-97.png
http://alrik-online.de/alrik/screens/javaw%202015-08-28%2002-29-01-23.png

1 Like

Just curious, but what did you change?

HDR is supported by jME3’s ToneMapFilter, but the skybox needs to have intensity values higher than 1.0 for it to actually do anything.