Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Released] kode80 Volumetric Clouds (Ver 1.1.0)

Discussion in 'Assets and Asset Store' started by kode80, Dec 4, 2015.

  1. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    CloudsVidThumb.jpg
    The last few months I've been working on a fully 3D volumetric clouds solution for Unity3D. kode80 Clouds is now available!
    • Fully 3D, raycast rendered volumetric clouds
    • Realtime sun lighting via a regular Unity directional light
    • Raycast shadows from clouds onto your scene's geometry
    • Animatable ambient lighting
    • Simple setup, add to your scene, pick a camera to render to, go!
    • Fully animatable, from the clouds themselves to their position in your scene
    • Custom Unity integrated editor that allows you to paint clouds directly into your scene
    • Lots of optimization options, including spreading the rendering workload across multiple frames
    • Export high quality cube maps straight from the editor, for lower powered devices


    Latest Version: 1.1.1 (released April 20th 2016)

    Rather than selling kode80 Clouds in the Asset Store, I've decided to try something different. The project is hosted on GitHub & is free to use for non-commercial purposes.

    If you'd like to use kode80 Clouds for commercial purposes, or support this & future kode80 development, commercial licenses are available for purchase from my new online store!

    Full details available here: http://kode80.com/blog/2016/04/11/kode80-clouds-for-unity3d/index.html

    I'll keep this thread up-to-date as well and look forward to your feedback!
     
    Last edited: Apr 21, 2016
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    @caitlyn rush this one through ;) Rob the Hippo wants <3
     
    kode80 likes this.
  3. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I like this a lot
     
  4. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Thanks!
     
  5. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Looks amazing Kode :) Will keep an eye on this one :D
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Looks really great. Looking forward to it.

    Is the sky gradient also rendered by your plugin, or is that the default procedural skybox from Unity?
     
  7. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Yup, it's just the standard procedural skybox. The clouds buffer is simply drawn from the camera's post render delegate as a screen aligned quad at the far clip plane, so it draws over the skybox but under the scene. This allows you to use any existing skybox with the volumetric clouds drawn overtop.
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Ok, good, because I thought it was the weakest part in the images you showed :p

    The clouds themselves look really great. :)
     
  9. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Hehe, thanks. I figured for now this was the most flexible approach, so people can still use photographic skyboxes for background etc. I am still seriously contemplating expanding the shader to be a full skybox shader that'll render it's own atmospheric scattering/cubemap etc. but if so, that'll definitely be post-launch.
     
  10. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    To be completely honest, I am making a completely underground game. But that said, I just wanted to stop in and comment on how nice those looked. Those look amazing.
     
    kode80 likes this.
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    I am imagining a situation where i have an hdr photobased cubemap with slight cirrus/stratus clouds and then your plugin on top for the more cumulus clouds. I bet it's going to look great.

    (with that said, I am definitely not against turning this into a full fledged sky plugin)
     
  12. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Yup, exactly my thoughts. Or, a nice night sky with the cloud's ambient/direct light colors set to reflect the moonlight color.
     
  13. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    Hey, your Cloud system is looking great, probably the best one I've seen so far judging from the preview.

    With that said, I do have some questions/requests/suggestions:

    I noticed the clouds seem mostly very "planar". They look good in some screenshots but when you move around it becomes more obvious. I think this stems both from lack of height variance, both in position (all Clouds are in the same plane) and size (all clouds are equally tall).

    http://www.rgbstock.com/cache1pn2PJ/users/t/ta/tacluda/300/mJdHHlA.jpg
    Even clouds positioned around the same height can have wildly different vertical sizes:
    http://miriadna.com/desctopwalls/images/max/From-airplane-window.jpg

    Another good example:
    https://upload.wikimedia.org/wikipedia/commons/4/47/Cloud_From_Plane_1.jpg
    https://twistedsifter.files.wordpress.com/2014/03/sea-of-clouds-from-an-airplane.jpg?w=800&h=534

    I think this is the reason why most cloud systems look incredibly fake, since it's usually a plane of clouds looking at us, stretching all the way towards infinity, which is not how clouds look like. At distance, we can see the full body of the larger clouds and they usually cover the sky horizon. Clouds beneath that line tend to look very misty, so the distant sky can often look like this:
    http://i.jootix.com/o/unnamed--4f28f54a61.jpg
    You only need one big cloud to cover everything behind it, which will eventually happen at some distance. The "clouds stretching toward infinity" are usually very misty.
    https://bangkokprojects.files.wordpress.com/2013/09/dsc_4265.jpg
    Clouds at distance can often look more perpendicular to the plane than parallel, which is how CG clouds, even good ones, usually look:
    http://www.indigorenderer.com/sites/default/files/clouds.jpg

    Anyway I'm pretty sure you've given consideration to these issues, but I had to illustrate my point. This is a problem that every real-time 3D solution I've seen faces, but if you can solve it and improve in this area your solution is gonna be even more fantastic.
     
  14. Thomas-Pasieka

    Thomas-Pasieka

    Joined:
    Sep 19, 2005
    Posts:
    2,174
    That's looking rather nice! My question would be, is it VR ready?
     
  15. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Thanks! I really appreciate the feedback.

    I think the planar look you're referring to is more a due to the specific clouds in this scene than anything else. The atmosphere is a thick wedge, literally 2 spheres; one acting as the start of the atmosphere, the second acting as the end of the atmosphere. The clouds in this tech can exist anywhere within the atmosphere and can have height across the full range between these 2 spheres. My editor gives you the ability to alter the height of any of the clouds as well as the way they are modeled, from flat and diffuse to tall and defined. A lot of the clouds in the scene shown in the video are more in the former category, if you look later in the video, the clouds behind the camera are more in the latter.

    Also, again since the clouds exist in a spherical atmosphere, it is entirely possible to watch clouds move away from the camera and eventually sink down below the horizon. There is no infinite plane used in this approach.

    I'm going to be producing a final promo video for the asset this week that will hopefully demonstrate the full range of cloudscapes you can achieve and I'll definitely bare this feedback in mind because the last thing I want is to give the impression this is just another flat cloud plane style solution.
     
  16. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    I haven't tested it in VR yet (I have the DK1 and DK2 sitting upstairs). This & mobile are my first checklist items post-launch. There's nothing (outside of performance requirements) that would prohibit this from working in VR and in-fact I'm expecting it to look rather great since it's a full 3D solution - i.e. you'll get true stereoscopic depth on the clouds.
     
  17. GCatz

    GCatz

    Joined:
    Jul 31, 2012
    Posts:
    282
    will there be an option to change Y axis of the clouds ?
    so we can also look on them from above ?
     
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    *flinches and makes a half-hearted grab for the framerate butterflies fluttering out of reach*

    The full VR thing would be pretty amazing.
     
    Thomas-Pasieka and kode80 like this.
  19. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    that looks awesome :)
     
    kode80 likes this.
  20. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Right now, no. The goal of this is asset is to provide quality 3D, animated clouds from a ground level. To be clear, the camera is free to move up/down and you will see the clouds rendered correctly (i.e. as you walk up a mountain you will get closer to the clouds) but the camera must remain inside the atmosphere.

    This isn't a restriction of the tech, just a design goal to keep performance/code maintainable. It would be entirely possible to render the reverse, i.e. outside the atmosphere looking in, it would just need a slightly modified version of the shader. If there is enough demand for this, it's definitely something I can work on.
     
  21. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hi kode80,

    Looking really good. I wish you good luck with your Asset Store adventures (I think this is your first asset right?)
    I was also looking in to way to use a sky only HDR + moving ( and looking good) clouds.

    I was wondering if there is any way you can share your system specs and how much time this needs in your system?
    Have you done any test with any post effects?
    Do I get any advantages if I use this with a constant time in a day or/and no cloud fly-thrus? Just moving clouds from a 3rd person perspective.

    Thanks
     
  22. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Thanks! (yup first asset, on the store at least)

    My dev machine is 2013 Macbook Pro (Nvidia GT 650M 1gb ram). In the scene shown in the video above, I get a constant framerate of around 45fps. With a scene containing only the clouds I get a constant 60fps. On my machine, with the profiler running, the cloud render takes about 8ms. Needless to say, any mid-range PC is going to be far better than my 2yr old MBP - so performance should be great on desktop machines.

    Since the clouds are rendered every frame regardless, changing position/lighting/animation etc. is essentially free. There are various optimizations in the raycast that favor empty sky (since lighting calculations etc. only need to be done when inside a cloud) - this means that a clear sky with only a few clouds will run faster that a highly detailed sky.

    There are also several optimizations available from the component's inspector; spreading render workload over N-frames, downsampling/setting specific cloud render resolution and limiting the rendered area of atmosphere. The latter one means that if your horizon is largely obscured by scene geometry you can avoid rendering that area of the atmosphere.
     
    Last edited: Dec 7, 2015
  23. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Does that also mean we can render out a cube map for clouds that are very far away (at the horizon) and only use volumetric clouds for clouds that are closer to the player?
    How about post fx? any tests done yet?
    What is your screen resolution on that video?
     
  24. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Yup, you can totally do that (my editor also allows you to export HQ cube maps of your clouds/scene directly).

    I've tested with a few post effects. It doesn't really have any impact either on compatibility or performance. The clouds themselves are rendered to a RenderTexture and then drawn in your scene manually with a full screen quad. This all happens before ImageEffects are run, so shouldn't impact their use at all. Performance is obviously the same as it would be with/without clouds/image effects.

    The resolution in my mentioned tests is 1440x900. I actually forced it to render at 1080 last night and got around 35fps on my MBP for the above scene.
     
  25. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Ohh now I get it! I was actually asking for compatibility reasons but your reply answer that.
    Thanks

    Now patiently waiting for any kind (standalone, web) of a demo scene :)
     
  26. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Awesome. I'm working on a demo scene for the promo video this week. I'll release it as a standalone once it's done.
     
  27. sashahush

    sashahush

    Joined:
    Sep 5, 2012
    Posts:
    75
    This looks really nice! Can you fly through them?
     
  28. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Not currently. In the current implementation the camera is restricted to below the atmosphere.
     
  29. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I'm really fine with not interacting with them for speed reasons :)
    In fact for very slow moving clouds, maybe an optimisation is to slowly fill a cubemap - would that even work, I wonder?
     
  30. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    It would definitely be possible to generate the cube map at runtime if you don't require animation. The only limit would be the time it takes to generate, which just like the realtime clouds could be spread across frames. It's really a case of what you'd show in the N frames it takes to generate, of course there are workarounds for this.
     
  31. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    How does the whole clouds moving across sky actually work in the system? I understand the painting process but not moving the painted result.
     
  32. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    There is a 2D coverage map (this is what you are painting to in the editor) that dictates the cloud density and cloud type at a point (x/z) in the scene. For cloud type, there are 3 gradients that dictate the height of the cloud and how the noise is combined, the type value blends between these 3 gradients.

    Cloud movement is simply a case of scrolling this coverage map's offset.

    For more complex movement it's entirely possible to update the coverage map at runtime. For example, you could create some cloud coverage images which you would then blit to your coverage map like sprites and manually control their movement/opacity etc. Alternatively you could create a CPU simulation who's output would be the coverage map.

    An even simpler option would be to create several coverage maps in the editor and then blend between them at runtime, they could even be scrolling at different speeds/directions etc. the rendered result would essentially look like the 2 coverage maps morphing into one another depending on how you blend them.
     
    kenshin likes this.
  33. spraycanmansam

    spraycanmansam

    Joined:
    Nov 22, 2012
    Posts:
    254
    This looks fantastic. We'll definitely be picking this one up. From what you've described with the coverage maps, it sounds like it would be easy enough to incorporate the clouds into a dynamic weather system for storm clouds to "roll in"...
     
  34. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    or break a hole in it for a giant ufo to descend and destroy mankind.
     
  35. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184
    Hey @kode80 ,
    is the full source code provided with the asset? Id like to get this to also learn how to use 3d textures (iirc you use 3d textures to store the data and some kind of raymarching?) since the online resources arent that many :)
     
  36. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Thanks! Yep, dynamically updating the coverage map is an area with a ton of potential, especially for realtime weather effects...
    ...or alien invasion. :D

    Another thing I've thought about but haven't personally tried yet is using a terrain's height map to generate the coverage map - clouds forming over high points in the terrain etc.

    Yup. Full source is included, including the cloud painting editor. It's all C#.
     
    radimoto, Seith, moure and 1 other person like this.
  37. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    I posted some images from the demo scene I'm working on to Twitter last night. Screen Shot 2015-12-09 at 11.24.18 PM.png Screen Shot 2015-12-09 at 10.11.08 PM.png Screen Shot 2015-12-09 at 10.10.15 PM.png Screen Shot 2015-12-09 at 10.12.33 PM.png
     
    radimoto, Lex4art, Seith and 2 others like this.
  38. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    Looking great so far.
     
  39. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    I uploaded a quick animation test for the demo scene.

    Just using basic Unity timeline to animate sun/cloud properties. I'm going to throw together a script this weekend that allows auto blending of various properties based on sun position in sky, which will make time-of-day transitions a lot easier to manage.

     
  40. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Been a while. Any news? @kode80
     
    spraycanmansam likes this.
  41. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    I believe he is doing research by playing Xenoblade Chronicles X. :p

    (jokes aside, I'm also interested in news about this)
     
  42. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    Hehe, there are too many hours of research in that game, it's great. (some really beautiful cloudscapes too, although static)

    I'm back from holidays this week and working on getting this packaged up. I ran into a Unity 5.3 shader compiler bug just before Christmas that took some time, unfortunately it has been confirmed by several other people as a compiler bug on Unity's side for the new GLCore support on OSX.

    Thanks for the patience, I'll keep this thread up to date.
     
    hippocoder likes this.
  43. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Just make it so good that I really can't live without it :D
     
  44. jgjkkkxghckukuktukuuyjuAniow

    jgjkkkxghckukuktukuuyjuAniow

    Joined:
    Apr 8, 2014
    Posts:
    7
    Wow!) Good work) I wish you good luck!) ;)
     
  45. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Unity not fixed this yet? :)
     
  46. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    I'm still working on it and am giving serious consideration to releasing it outside of the Asset Store in a similar fashion to PixelRender (which I've just launched). I'll keep you posted!
     
  47. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @kode80 let me know when if you release this! I'm interested :)
     
    kode80 likes this.
  48. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @kode80 by the way can these clouds be lowered like clouds/mist flowing over mountains? I have a long bridge for example and one side needs to disappear into the thick mist/clouds
     
  49. kode80

    kode80

    Joined:
    Aug 1, 2013
    Posts:
    151
    As it stands, no. You would have to emulate this with standard fog/billboards.

    Long term, it is possible. A while back I made an experimental branch for testing this, using the depth buffer to do clouds/scene intersection. It works, but would require some larger changes to the way the clouds are rendered, which is more taxing than having the clouds layer always above the scene geometry.
     
  50. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Hi kode80,

    The clouds are really volumetrics? Can you fly between them or be above?
     
    S_Darkwell likes this.