uSkyPro – Precomputed Atmospheric Scattering [2.0 Beta]

Okay, my idea for a current solution for usky2 is to overlay a transparent cloud skybox, 1) A skybox with the normal texture 2) a second one with a b/w mask.

I want to look the sky through the transparency areas. I want to inclluude 2 cubesampler in your skybox shader and combine the results. Do you think thats possible?

@Luckymouse

Awesome. That WebGL Demo looks great. The demo doesn’t work on mobile, which isn’t surprising at all of course considering the complexity of this effect.

Thank you very much for fixing the Z-axis bug.

1 Like

Oh I must have messed up when taking the screenshot and after playing around some more I noticed that if I move my terrain from -125 to 125 the occlusion starts working, strange. :confused:

I have another question. Is it possible to alter the color of the skybox ocean? Since my scene is surrounded by water and I quite like the blend between the sky and the skybox ocean I would like to have that enabled for my game. But my water has a toon like look and is brighter and more colorful than the skybox ocean so they don’t blend well together. I know this isn’t a feature but if I could get a point in the right direction I would really appreciate it :slight_smile:

About the “cubesampler” that your mentioned here, I assume that you are talking two clouds cubemaps, right?
I don’t know what reason you want two cube maps, the clouds texture definitely need a mask, but it can be stored in one of the texture channel, so it does not need the second texture, just more optimized, right?
if I misunderstand your question please explain more in detail.

I tested the atmospheric scattering in my old iPhone 5, it is a bit slow but it actually works. Which mobile platform did you try, Android?
I’m planning to re-work the atmospheric scattering for mobile later after new cloud implement.

World Scale parameter is for atmospheric scattering, doesn’t affect the occlusion. So your world size value does not matter here.
There are still couple thing that required for occlusion. Please check your scene setup.

  1. At least enabled one of the Directional light shadow. In this case it is the shadow of sun light.
    The occlusion is using unity built-in shadow cascades map that generated by directional light.
  2. Enable Shadow Cascades in Quality Setting.
  3. Shadow distance in Quality Setting need to set to higher value (such as 500 to 1000 etc), this value is related with camera far clipping plane. In general that higher value of far clipping plane need higher value of shadow distance. So the distance (depth) of the occlusion appears same as where the realtime shadow is.

Usually all this settings are already on by default scene and project setting. If you still have problem with it, please lets me know.

Is the occlusion in the uSkyPro atmospheric scattering scene demo working for your?
By the way which editor platform are you using, Mac or PC?

For now, the answer is no and the only option is disable the skybox ocean.
I did try to set some custom the color of the skybox ocean before, but result is just horribly ugly. I may try that again in future.

1 Like

@ nxrighthere
So far I didn’t find the performance issue for stars mesh generation, not sure why that happen to you. However I changed the code execution order of the stars mesh generation from Enable to Awake, it is more like how it works in uSky 1.x. Hopefully it fixed the problem for you in the next update.

About the light map issue you got that I tested and can’t replicate your problem here either. I’m still investigating it.
Which platform are you on, Mac or Pc?
Which unity editor version?

I was talking about your WebGL demo. It isn’t surprising that it doesn’t work on mobile as it isn’t supported. I used Android 5.

You are right. Because the atmospheric scattering is running so slow on mobile, so the current atmospheric scattering shader is disabled for OpenES support, but the new updated version enabled for mobile again. :wink:

I was tested on old iOS devices and It works now, newer high-end devices should be faster. This is at least suitable for some architecture demo or prototyping build on mobile and show it for your client.
Also you can the comment out “#define HORIZON_FIX” in Atmosphere.cginc for faster performance, By default it is always on, i think i may change it auto off for mobile later, since the screen pixels in mobile is general small, those artifacts may not noticeable on mobile anyway.

Of cause the mobile skybox version is recommended for mobile as well.

[EDIT]
Surprisingly that the newest iPhone 7 (I don’t have it yet) is actually running faster than my old macbook, and also the price for that you can almost buy a new laptop with it too.:eyes:

New version 1.2.0f1 on the AssetStore.
It is a hot fix update
ChangeLog

Change log

  • Now uSkyPro supports WebGL(HTML5) build. =================================
    Note:
  • This will work only in Unity editor 5.3.x or newer version, thus it is not supported in version 5.2.x. WebGL (Preview) build.

  • Currently support forward path only for atmospheric scattering to prevent the clipped specular with the material.
    That due to no camera HDR support in WebGL, it breaks the uSkyPro internal tonemapping of the scene. (Trying working around solution with it.)

  • At this moment Unity still does not fully support realtime Reflection Probe on WebGL platform.
    So you may experience some rendering error of reflection cubemap.

  • Currently occlusion may not work well that due to the limitation of the realtime shadow support on WebGL platform.
    Recommended it should be disabled on WebGL build for now.

  • “uSkyBoxPro mobile” material will work as well with faster rendering performance.
    ======================================================================

  • Fixed uSkyPro that has some compatible issue with PlayStation 4 build.

  • Occulsion: Fixed occlusion bug that missing in nagative Z axis.

  • Occlusion: Fixed some compatible issue of “AtmosphericScattering_Occlusion” shader with new Unity 5.4 shader API. (Removed “#pragma multi_compile SHADOWS_NATIVE” code.)

  • Occulsion: Now no matter MSAA (Anti-Aliasing) was enabled or disabled, the occulsion will always render with correct uv coordinate on Window based platform.
    (Occlusion pass will not flipped upside down anymore)

  • Occulsion: Added the “Occlusion Debug” toggle to drawn the occulsion pass only on screen.


  • Fixed atmospheric scattering artifact issue (Greenish on bottom) when sun is closed to horizon.

  • Fixed the uSkyPro has been multiply the exposure value twice in all the shaders.
    If your exposure parameter is not 1 (default value), than sky brightness may have slightly different. You may need to re-adjust it.

  • Fixed some swizzeling issue that between high and medium precision variables in the mobile skybox shader. So it is more optimized now.

  • Improved: Now Sun Disk has better rendering quality and added “Disable Sun Disk” toggle in uSkyPro setting.

  • Improved: The Reflection Probe will automatically update if any precompute parameters of uSkyPro that has changed.

  • Improved: The uSkyPro mobile material will render with better balance for sky brightness and reduced some darker area on the zenith of sky.
    If applied uSkyPro mobile material, uSkyPro will automatically set “Inscatter Altitude Sample” to X1, which it required.

  • Renamed “Runtime Time Slicing” from “RunTime Refresh Mode” in uSkyReflectionProbeUpdater script.

3 Likes

Looks nice, I need to increase light amount above 8! but it’s limited to 8. please help.
Thanks.

uSkyPro clamped to max of 8 because that is exactly same as what unity directional light intensity can take.
You can modify the Range setting in uSkyLighting.cs script (line # 31):

        [Range(0f, 8f)][Tooltip ("Brightness of the Sun (directional light)")]
        public float SunIntensity = 1.0f;

You are welcome to change it and try, however I don’t think unity light intensity will take more than 8.

1 Like

hi to all,

i am thinking to buy a day/night package as Usky, but i am wondering how difficult is to implement rain,snow and wind with it.

I am looking to use random effects with Usky, so if it is raining the sky and clouds must get darker.

  • Is this possible with Usky?
    -Do anybody know a weather package or plugin that works with usky?

thank you

txarly

As you know that uSky does not have weather feature out of the box, it is just more focused on dynamic sky lighting for your scene right now. In general, it is definitely possible to implement other effect to your scene via some custom scripts to achieve your own weather system. Most of the uSky settings and materials can be control by your custom scripts. It is hard for me to say how difficult to implement it, it really depend on how you want your weather system to be. If you just load different scenes with different weather condition which I don’t think it is hard. However if you want the dynamic weather within the same scene, it requires more scripting to do so.

Just keep in mind that right now only the uSky 1.X version have the clouds, and it is using a static clouds texture.
You can modify the shader to blend two different texture or fade the sky cloud color to grey to make clouds/weather transition…etc. The upcoming new procedural clouds for uSkyPro is still woking in progress, and it will be easier for dynamic clouds transition, but I don’t have release date on that yet.

As far as I know there are no third-party weather package for uSky yet. Please lets me know if anyone know it.

Will sky add a weather feature? Yes, possible in future version, but it is not priority at the moment.

Hi! I have a bug . Unity 5.4.1f1 // DX11 // Deffered // Linear. Latest uSky Pro Beta 2 v1.2.0f1/
Skybox in reflection probe is completley black.
Just create new scene, add uSkyPro prefab, create empty gameobject, add Reflection Probe Component, add usky reflection probe updater Component. Probe is updating but sky is always black. Same on baked probes.


I need to doublecheck, but I think it worked fine in 5.3.5p6

Yes, I got the same bug on DX11. It was working fine on Mac. Sorry about that.
Here is the quick fix:
1) Open the uSkyboxPro shader
Folder: uSky/uSkyPro Beta 2/Shaders/

2) Edit line# 80: REMOVE the “* sign(_LightColor0.w)” code

//change this
OUT.Sun_g = PhaseFunctionG(.99 , _SunDirSize.w * scale * _uSkyExposure) * sign(_LightColor0.w);

//to this
OUT.Sun_g = PhaseFunctionG(.99 , _SunDirSize.w * scale * _uSkyExposure);

3) Save the file, and done!

I also notice there are junk file in the uSkyPro beta 2 shader folder call: Clouds Advance.shader, it will occur error message in 5.4 editor and please delete this file.

I will re-pack it and upload it to assets store again.

[EDIT]
Just found another bug regarding the new “Disable Sun Disk” function, if enable it the stars and space will appear on the bottom of the sky. Don’t use it for now and I will fix it for next update.

[Edit2]
Submitted, new update is on the way.

Thank you very much for a quick fix!

@Luckymouse Can you show us how to use 1.x clouds with 2.x version?

I believe it not that easy for me to show you how, it need to rewrite the clouds script and shader. Instead I will do it for you.:slight_smile: I think I just need couple day for that, I will post it here if I finished.

New version 1.2.1 on the AssetStore.
It is a bug fix update for pervious uSkyPro version of 1.2.0f1. Please update this latest version.