Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

uSkyPro – Precomputed Atmospheric Scattering [2.0 Beta]

Discussion in 'Works In Progress' started by Luckymouse, Sep 14, 2014.

  1. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    Intro
    This project is inspired the atmosphere rendering technique by the Eric Bruneton ( ported to unity by scrawk) and cryengine’s time of day.
    [Released in Asset Store!]

    Upcoming uSky 2.0 Beta (uSkyPro)
    You can check it out here the WebGL Demo. (8.5Mb)
    Note: Currently no occlusion on WebGL build that due to the limitation of the unity realtime shadow support on WebGL platform. (looking and working around other solution with it.)


    For full feature demo please download the standalone version executable player.
    uSky 1.0 and uSkyPro Beta Standalone Build Demo Download links





    New uSkypro framework: precomputed atmospheric scattering

    uSkypro is using most advance the precomputed atmospheric scattering framework that is based on Eric Bruneton atmosphere rendering technique.

    The precomputed data can be share on skybox and atmospheric scattering image effect ( clouds too if needed). It doesn't required to re-calculate in different shaders. Make more sense in practice usage.

    This atmosphere scattering method is particularly working well from ground level to high altitude with any camera's viewing angles.

    A single layer of precomputed inscatter data represents as a "3D data" that included the full day/night cycle sky color and earth shadow. It can be included with ground level to high altitude sky data in multiple layers that as known as "4D Data".


    What is it?
    uSky
    is a Physically Based Atmospheric Scattering as a skybox. It will dynamically change the sky color with scattering based on direction of the Light. uSky is not only about nice looking background skybox, because it is a dynamically sky that you don't need to search for different HDR sky image anymore. uSky can lighting your scene with natural sky light color, and it allows you also to customise how the sky looks.

    Because uSky is skybox that it works flawlessly with Unity 5 RenderSettings build-in skybox-based ambient lighting and skybox generated specular reflection cubemap (global reflection probe). Ambient colour and reflection probe will completely and automatically generated with in Unity 5 Editor. So the color of the Scene contents (included both Dynamic and Static game objects) will automatically change according to the color of uSky.
    Right now uSky works also currently for any third party image based lighting system in Unity 4. You just need to manually create the convolve cubemaps and set it up.

    Features
    - uSky works with Unity indie and Unity Pro.
    - Support Gamma and Linear color space.
    - It is very optimized shader code for low end GPU friendly (Laptop).
    - Working with mobile platform.
    - No dll’s, working seamlessly with Unity Webplayer .
    - No DX11 required. So it is fully cross-platform compatible.
    - Compatible most of the current HDR image based lighting frameworks.
    - Working with the built in Ambient Skylight and Reflection Probes for upcoming Unity 5.

    Note:
    uSky requires SM 3.0.
    uSky is currently working the perspective camera view only.


    The Webplayer (File size 1.1Mb - Skybox shader: Requires Unity5 webplayer plugin installed )

    Webplayer (Quixel Textures) (file size : 37Mb Requires Unity5 webplayer plugin installed )
    [ Temporary using Gradient Ambient for webplayer demo, so not all the Sky setting will affect the Ambient Lighting]
    Quixel Textures in Unity 5 Ligthing Test
    Quixel_textures_Unity5_b.jpg

    Here is some IBL lighting test result:




    uSky_Antonov_Head_Logo.jpg









     
    Last edited: Nov 17, 2016
    Lex4art, Farelle, spinnerbox and 6 others like this.
  2. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    Looking good I can give it a try on my dx11 soon
     
  3. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    It works very nicly with dx11
     
  4. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Ah very nice. Is sun flare coming together with system? Also atmosheric effect changes depending on light position or its angle?
     
  5. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
  6. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Nice ! Just tried the lite version ( no HDR right ? ) :




    Getting some good results so far !
     
    MegsTan likes this.
  7. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    Thanks mathias234, glad to know uSky works well on Dx11.

    Yes, the sun flare is coming from skybox itself, so far the uSky only renders 1 draw call only for the day and night sky. Please try out the uSky Lite project, you may get better idea.

    [updated]
    uSky will only count on the light directionally, it means the rotation only. The position of the light has No affect for the sun flare on the sky.

    (By the way)
    The 2nd draw call is the stars field at Night time. 3rd draw call is for upcoming sky clouds, Both of this draw call are only in uSky standard version, not in uSky Lite edition.

    Yes, you can blend uSky with any other unity skybox material. uSky material itself is just a skybox.

    In uSky Lite edition you can easily blend with other night sky. However if you blend with other skybox from uSky standard version, you may lose the original night sky.
    In this case, you can modify the shader to add up one more cubmap as the background inside the uSky night sky. I guess I can include that with uSky in the future too.
    By the way, After uSky submitted to asset store, all the source code will be included in the package.

    Thanks for sharing your testing image, it looks great.
    The both version of uSky is HDR shader. However after i saw your testing image, I'm just thinking that uSky itself has been HDR tone mapped already. Right now it is good for using for diffuse as Image base lighting. It may be not really good enough for HDR lighting for specular, it may be even better that if it renders another HDR cubemap without the tonemapping. In this case it will work for SkyShop and Unity 5 as well. Anyway, I will do more research how uSky works with other physical based material and HDR lighting in the future.
     
    Last edited: Sep 15, 2014
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,382
    Works flawlessly in my place with Dx11, my only comment is the sky color really show differently in Linear space and Gamma space. But that's only my nitpick :), for the rest it works great
     
  9. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    Yes, I noticed it too, i will add the different gamma space option soon.

    Some update:
    Just did some more GI testing with uSky in 5 beta. Seems the HDR tone mapped that i mention earlier does not matter how it light up the scene, the brightness can be adjust by skylight intensity setting. I will post some image in the future.
     
  10. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Makes sense, I was having color cliping in my specular and diffuse cubemap. Would be nice to add an option to deactivate the tonemapper if some others like me use an image effect tonemapper.

    Thanks and great work !
     
  11. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    Amazing work, was the Unity 5's Procedural Sky's shader used as a base for this shader?
    and btw definitely gonna buy
     
  12. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    When will the first release be?
     
  13. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    In the very beginning, it was thinking about that already, since you mention it, you just remind me again. Yes i will definitely make the sky tonemapping able to turn ON and OFF. In this case make more sense to have full HDR lighting for the scene, so user can turn on the camera HDR option and apply tonemapping image effects.

    I guess many people may have same thought as you, but the true is uSky is NOT based on Procedural Sky from Unity 5 at all. I start it very early on and i finish it before i even know the Procedural Sky in Unity 5. uSky is mainly based on Eric Bruneton and cryengine technique. Do you know the Atmosphere Fog from unreal 4 is based on Eric Bruneton source code as well?. In my option Epic did NOT do the good job for that. original Atmosphere from Eric Bruneton looks much better.

    uSky is based on:
    // --------------------------------------------------------------------------------
    //PHYSICAL MODEL REFERENCES
    // --------------------------------------------------------------------------------
    //RayleighColor : Preetham
    //MieColor : EricBruneton
    //Scattering : CryEngine
    // --------------------------------------------------------------------------------
    //OTHER REFERENCES
    // --------------------------------------------------------------------------------
    //NightSky : CryEngine


    The reason I pick them as reference:
    1) Preetham gives nice physical blue sky in simple and practical optical depth algorithm, 2) Eric Bruneton's physical sunset sky gives the best and realistic result that i ever see so far, 3) CryEngine's physical scattering gives good result and optimized performance. 4) CryEngine's night sky just looks good, simple and practical for game. Specially the HDR Stars from cryengine, I just love them.

    Unity 5's Procedural Sky just make me realized that I need to convert uSky from skydome to skybox, thats all.

    By the way, the sun glare looks like from cryengine too, but I implemented by myself. it has better natural look than the one from Unity 5's Procedural Sky.

    I know mixed up all this formulas sound crazy. I Just felt like created a monster by myself too.
    [Edit] monster = Frankenstein :)

    Should be around 3 to 4 weeks. Need to finish up the sky clouds first and do some more testing before ship it.

    More info:
    Just tested uSky run on HTML 5 WebGL nicely.
    Can't wait for the iPhone 6 to test, uSky is running already 60fps on iphone5 ( not iPhone 5S, it is just iPhone5 ) :)
     
    Last edited: Sep 20, 2014
    shkar-noori likes this.
  14. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    this asset as it looks like will be something that should live in every dynamic game. waiting for release on U5.
     
  15. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,382
    It doesn't matter as long as the monster still under control and not going frenzy in the whole village it's still a good solution
     
  16. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    935
    Hi man i have one question, since your shader is working with skybox which is awesome, when the sun is down it render the bright on the opposite side of the sun too, it's normal or..?
     
  17. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    It happen because of physical scattering throughout the sky, It is physically accurate and correct when the sun is above the horizon. so yes it is completely normal.

    By the way if the sun fall down, the earth should cast the shadow which I didn't implement that earth shadow algorithm yet. The code of this physical shadow will not be cheap, at least for mobile platform. I will keep looking for cheaper method to fake the earth shadow in future.
     
    Last edited: Sep 17, 2014
    shkar-noori likes this.
  18. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,869
    Um, why is windows saying something about encrypted folders when Unzipping?

    EDIT: This is AMAZING! keep it up!
     
    shkar-noori likes this.
  19. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    765
    Looks get great! :)
     
  20. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Awesome :).
     
  21. NexGen

    NexGen

    Joined:
    Sep 10, 2013
    Posts:
    51
    This is looking really nice!
     
  22. thylaxene

    thylaxene

    Joined:
    Oct 10, 2005
    Posts:
    705
    Will uSky have a moon option?

    Anyway looks fantastic and I'm glad it works without D11! So looking forward to the release and you can count on my purchase. Keep up the great work!

    Pipe dream: multiple suns and moons. :)
     
  23. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    Thanks all of your comments.

    The moon is just a image file and user can replace it with any other type of moon image. User can change the moon direction by a gameobject that the moon image will match it up the position on sky, just like how the sun works.

    The default of uSky will have only one Sun and one Moon. If you want more than one, just need to add a custom Sprite or Quad plane to the scene.
     
  24. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    can we have a test version for Unity 5 Beta?
     
  25. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    Here you go.

    Edit: for better lighting result, turn off the Ocean Fog. Still It is a experiential and WIP project. We will keep improving the shader.

    Note: This shader will only work for Unity 5, if you are currently using unity 4.x, please download the unity project in the first post.

    Edit: Removed File
     
    Last edited: Oct 13, 2014
    shkar-noori likes this.
  26. rubenedra

    rubenedra

    Joined:
    Oct 22, 2012
    Posts:
    7
    Nice!! Looking forward to the release!
     
  27. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    uSky in Unity 5 beta lighting test image. Only using the uSky Lite and 1 Directional Light (Sun)
    Scene Render Settings:
    Ambient Mode: Skybox
    Default Reflection: Skybox
    Note: The model is from Quixel

    Edit: I noticed the surface that facing the bottom is too bright. If I higher the value of Ocean Fog, The model will become very blue. I will to redo the bottom part of the uSky (Ocean Fog).
     

    Attached Files:

    Last edited: Dec 9, 2014
  28. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,319
    Wow. That looks amazing.
     
  29. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,881
    Very nice.

    I have to admit i am lost with all the sky options, i am actively looking for a day/night sky solution that will be compatible with Unity 5 and ideally would also support Skyshop that i currently use.

    This one looks very impressive :)
     
  30. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    I know exactly what you mean, there are considerable diversity sky package out there. Different package will achieve different goal. Well it just like a buffet, pick the one it is the best for your need.

    Technically uSky can support Skyshop that we can just make uSky generate a diffuse and specular cube maps. Frankly people who upgrade to Unity 5 that they have almost no reason to use Skyshop any more. Unity 5 has all the Skyshop's IBL features in it. Right now uSky is focusing mostly on Unity 5.
    The nice thing about Unity 5 that it will automatically generate that cubemaps from uSky. :)
     
    Last edited: Oct 3, 2014
  31. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,881
    I have to agree, seems like Unity 5 will replace Skyshop. But my project is so complex that i fear Unity 5 will just render it unusuable, thus i would want to make sure i have a solution for Unity 4 before 5 releases. Plus we dont even know when it will release and if all the various plugins will play well with it right away, or take ages to have a working game again.

    So i try to have a system working right now, while also looking into the future with lots of interest :)
     
  32. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    Good news for all SkyShop users, uSky compatible with SkyShop!
    [Edit]:
    Skyshop is able to capture the scene and render as panorama Image for cubemap generation. Another physically based shader with IBL system can capture the scene to cubemap too. In this case they may all some sort of working with different sky system as well. The only issue is which sky system will provide decent HDR Lighting result for the scene contents.

    At the moment Skyshop and other IBL package can only bake the different time of day to Cubemaps. As far as I know, we still can not do the full real time day/night cycle.
    However, there are possible to do the real time day/night cycle without reflection or using dynamically screen space reflection (raytracing)...etc, then It will not be low end GPU friendly. GI is another issues need to solve too.

    Actually beside the SkyShop, I tested with Antonov Suit and Lux that they works all seamlessly with uSky!

    Also I improved uSky for better HDR lighting and fixed some bug in Unity 5. All the try out project in earlier posts are outdated. I will remove them soon.
     

    Attached Files:

    Last edited: Dec 9, 2014
    mathias234 likes this.
  33. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,881
    Very cool !!!!

    When is the asset planned for release ? The Skyshop integration makes all the difference :), thanks for that.

    Another question, is it possible to affect the coloration of the sunset (the orange end color, the pink before the end is what i want) ? Say i want the color to be more reddish or other than orange, is that possible ? Would be lovely to have a tone shift or direct color chooser for that exposed.

    EDIT: I played a bit with air density and is one factor to affect the color, which is already great i guess :)

    Another question is about ocean fog, is it using Unity fog or a separate system ?

    Thanks
     
    Last edited: Oct 7, 2014
  34. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    Yea changeing colour would be great for like a sci-fi game
     
  35. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    For uSkyLite I can submit it to Asset Store very soon. Basically it is a clear sky for HDR lighting and background skybox.

    For full feature uSky may take a lot longer time to develop, don't have release date yet.
    In the past week, I was focusing to test HDR lighting of uSky on Unity 5 and many other Physically Based Shader frameworks, haven't got a lot of time to work for the sky cloud. Also I think I will re-design some idea of the uSky features from my original plan.

    Just to make it clear, uSky and uSkyLite is separate package. Planning uSkyLite price is around $15-$20, uSky is around $50-$60.

    I'm not sure what do you mean by "the pink before the end". Anyway If you want sunset color for more reddish color, yes i can modify it to give the air density for wider range. it can be really red. Night Zenith Color parameter can shift the sunset sky color as well.

    Because it is physically based sky, right now user can change the Wavelength value for sky color variation. Wavelength will act pretty much like RGB value, you can definitely shift color hue, saturate or desaturate the sky color.
    The simple color picker will be easier to use for most artist. I will add it that only if it works well.
    There are many parameters are only available in the uSky, but not in uSkyLite yet.

    I guess the name made people confused, the ocean fog is just a fake gradient at the bottom of skybox. It has nothing to do with Unity fog.

    By the way, the Ocean Fog will be replace by bottom color picker. It works similar as the bottom color in Procedural Sky from Unity 5. It will generate better hemisphere diffuse cubemap.
     
    Last edited: Oct 7, 2014
    nasos_333 and Charkes like this.
  36. VIC20

    VIC20

    Joined:
    Jan 19, 2008
    Posts:
    2,420
    To be honest, I don't see a difference to SilverLining or TimeOfDay here. They all offer these features (including the upcoming GI features of Unity 5) and they all run without any problems on any older mobile device. (except for the volumetric clouds in SL which can be heavy depending on the settings, but this is a feature on top in comparison). Only the stars position data is not available in ToD but it is in SilverLining. And there are already a lot of other more simple asset that offer less complex calculation of the sky colors than SL does for a low price. And some other interesting complex new assets are already in the works or out (like TrueSky which unfortunately is windows only).

    I love having new options but currently I don't see them and I think your description is a bit misleading because "What is this uSky different than others Dynamic Sky Package" actually lists what is identical to other dynamic sky packages.

    Don't get me wrong, I don't want to disturb the party, I write this this because I hope you will search for new interesting ways to render dynamic clouds with convincing lighting on mobile (not just a simple forward scattering). Currently volumetric clouds still look best but are too heavy and a waste of performance if you don't need to fly through. And the cloud dome in ToD is still too far from being really convincing. My own cloud solution isn't perfect too and so I really hope you will take a look on the weak spots of the other packages to try to make better where others still not offer the best possible solution yet.
     
    Last edited: Oct 7, 2014
  37. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    @VIC20, Thanks for your advices. It is just a WIP project, I will do my best. What is uSky different than others? I think users can tell later.
    By The way, have you try the uSkyLite project yet?
     
  38. VIC20

    VIC20

    Joined:
    Jan 19, 2008
    Posts:
    2,420
    Yes sure, I've downloaded it right when I saw it. And I also use several other sky assets so I can compare it.

    Sky and environment generally are extremely important for me and I have written my own mobile real time global illumination system (Unity 4) for my game. (you can see it with time compression @ 1:00 minute - the camera and display are naturally out of sync, this and the finger touch could make you think it stutters - but it actually runs perfectly smooth at 60 fps)

     
    Reanimate_L and hopeful like this.
  39. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Really well done. Do you mind telling, if this GI system of yours will roam on Asset store? Also which water shader are you using?
     
  40. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    Very impressive lighting and ocean effect, nice to see it run on mobile.
    I don't want to criticise other people products, Everyone see thing differently. Sometimes we don't like what is available in the market, so we just write our own one which meet for our own need.
     
  41. VIC20

    VIC20

    Joined:
    Jan 19, 2008
    Posts:
    2,420
    Water and all other shaders are my custom shaders except the sky itself which is SilverLining. I have no plans to sell it and beside that it requires special shaders (no time to write more than those that I need and no time for supporting customers) …and Unity 5 will offer GI anyway.

    Sometimes you have more work with using an asset than doing it on your own. I'm currently working on new clouds but can't wait to see what kind of clouds you want to include to uSky.
     
  42. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    268
    Hi VIC20

    I have to say that this is a damm good ocean shader , probably one of the best i have ever seen on unity
    I know you are working for a long time to get the ocean right, i think you finally made it.

    Cheers

    Norby
     
    VIC20 and hopeful like this.
  43. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Hey,

    Just did some skin test with uSky, great results so far. I will test my screen space subsurface scattering next (Penner used in the shot).

     
    shkar-noori likes this.
  44. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    @Charkes
    nice!

    Rewrote the first post and updated some the images. So far it is a only one version just call it uSky (no more uSkyLite). The next full features uSky that i mention earlier post will name it as uSky Pro in the future release.

    Added uSky that has more parameters for customise the sky.
    - Sky Tint
    - Exposure (renamed from previous Sky Multiplier)
    - Rayleigh Scattering
    - Mie Scattering
    - Density Scale (renamed from previous Air Density)
    - Altitude Scale
    - Sunset Time Offset
    - Sunset Zenith Color
    - Ground Color (replaced from previous Ocean Fog)


    nasos_333, is it red enough for you? ;)

    uSky is now support for Linear color space lighting !
    I'm working on some basic user manual document, anyway uSky is easy to use.
     

    Attached Files:

    Last edited: Dec 9, 2014
  45. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Luckymouse will Usky solution work with new Unity 5 environment lighting? I am thinking yes becouse your solution is practically filling skybox shader.
     
  46. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,881
    Great, i feel this kind of customization will bring this to a new level. Having an accurate sim is great, but having a artistic friendly accurate sim is amazing :)
     
  47. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    Yes, already tested in last version of unity 5 public beta that uSky is working with Render Settings build-in skybox-based ambient lighting and skybox generated specular reflection cubemap. When the Sky color has changed, both of ambient lighting and reflection cubemap will automatically update their color as well.

    I don't know if Unity 5 will be different when it released, I will keep uSky update. Compatible with Unity 5 new physically based shading workflow and new lighting environment is the purpose why i make uSky.
     
    Last edited: Oct 16, 2014
  48. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,094
    I've been holding off on getting a dynamic sky solution. Any chance you could show what kind of clouds uSky will have?
     
  49. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    481
    Sorry wetcircuit, at the moment, it is still working in process I don't have any screen shot ready yet.
    we are trying make the cloud layer inside the skybox it-self (same as you just use a regular sky image for skybox), and the cloud will change color from different sun position.
     
    SAOTA, wetcircuit and sqallpl like this.
  50. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Oh so Usky will have clouds and weather support too?