Search Unity

Volumetric Clouds

Discussion in 'Assets and Asset Store' started by Eideren, Oct 20, 2014.

  1. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    181
    Hi ! I just bought your asset today, but i have some problems :/.



    That's what happen when i use my own skybox ... It's possible to fix that or not ? :)

    Thanks !
     
  2. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    It doesn't happen with Unity's default skybox, right ? Did you write your skybox or does the shader comes from a third party ? If you wrote it, you should check that it doesn't write to depth and it's queue is set to background.
     
  3. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    181
    Yep, i write my own shader for the sky. I fix the problem at that point, but since i imported my Shader Forge package all your cloud shader turn to pink, i complated them again but no change, maybe it's a problem with my Shader forge version, i use the version 1.25, tryed with 1.26 too but any change. Do you have an idea who i can fix that ?
     
  4. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Only the shader forge cloud or the standard cloud as well ? Well, what does the console says ?
     
  5. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    181
    Shader warning in 'Cloud/Standard': Output value 'vert' is not completely initialized at line 142 (on d3d11)

    That she said :/.
     
  6. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    This one doesn't crash the shader, it's a warning, did you get any other message ? You could always try to reimport the folder (right click > reimport).
     
  7. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey Eideren,

    Your clouds look amazing but they cause a large performance drop when in VR (Oculus). When the player can see a large portion of clouds we are seeing a 30-40fps drop, is this normal? I hope we can get this fixed because our scenes look 10x better with these clouds!

    Here are some screen shots of our cloud mat setup.
    upload_2016-4-7_0-51-24.png

    upload_2016-4-7_0-51-41.png

    Cheers,
    Colton
     
  8. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi,
    Thank you, yes it kind of is normal, rendering transparent materials isn't cheap and even less so by doing it twice at a high resolution and multiple times per pixels, I'm not sure as to what your target platform is but going for anything besides very high end (talking about 980 tis and Fury Xs here) should be near impossible for VR with this shader and the rest of your game's rendering, still you could probably reduce the texture's resolution, increase tiling on the material and render the clouds to a lower resolution than the rest of your game to save some performance but don't expect too much, you'll maybe be able to save 10 to 20fps by doing all of the above.

    Good luck !
     
  9. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hello everyone,
    The fix that I was working on since january has been tested and does work, thanks again @ledbetterman and @faak92 for your contribution!

    This next update will introduce some major changes :

    From 2.0 and forward support for the slice based volume rendering will be dropped in favor of raymarching, what that means for you is :
    • A big boost in performances.
    • Higher overall quality.
    • Potential infinite draw distance (logical only, floating point precision will give up at some point)
    • Lower memory footprint since the mesh is now useless.
    • We don't really deal with meshes anymore so rendering from every sides is now far more accurate(yes, even clouds inside).
    • Higher control over performances with maximum steps, step size, texture lod offset and some other potential stuff.
    Features that might be dropped :
    • Object space mapping, in this case it's local to your camera which is not very usefull, I might add support for external object if people actually need it.
    • Normals direction inverting, caused confusion and was probably never used anyway.
    • Curved option, I will try to implement it but I can't really promise much, there's a whole bunch of optimizations that might not work with it so, we'll see ...
    Here's what it looks like :

    Performances won't be that high, unity's stats are kind of broken but they are above 140 fps for sure

    And here's how it's rendered :


    This update might be done by the end of this week, I'll inform you has to when I send it to the asset store.
    If you which to request a feature, now is the time !
     
    punk and Duende like this.
  10. Dolzen

    Dolzen

    Joined:
    Mar 26, 2014
    Posts:
    90
    I was going to buy this asset because of the curved feature. In the new 2.0 version, if I have a spherical world I wont be able to use this asset? I mean, clouds wont be arount the spherical world?

    Thanks!
     
  11. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi !
    For versions below 2.0 that feature can't close the shape entirely, it wouldn't be a sphere, just a curved plane. It is possible to modify the script to implement that but it won't do it out of the box.

    For 2.0 it simply is impossible to have curved rendering and a decent framerate, I tried it and it wasn't acceptable.
    I still have one possible way to implement it to try but that's probably going to be in another update since it's fairly complicated.
    Sorry ...
     
  12. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi,
    Version 2.0 is currently being uploaded to Unity and here's the change log :
    Fix :
    • Texcoord not written by vertex shader.
    • Random compile errors related to GI.
    Features dropped :
    • Object space Mapping
      With the new rendering system, object space is actually local to your camera which is not very useful, you still have access to x/z position offset under Cloud Transform z/w values
    • Normals Direction inverting
      It caused confusion and was never used anyway.
    • Shader Forge Nodes
      Instead of giving you the nodes I'll actually write a tutorial on raymarching with shaderforge on the wiki in a couple of days, this means that you'll have access to it without the need to buy my asset.
    • Curved rendering
      Most of the optimizations I took to render the clouds at a decent framerate don't work as well if I render it curved, performance hit is more than 4 times the planar one.
      I still have a second way to curve them to try out but that's for another update since I don't really have much time left.
    New Features :
    • Slice based volume rendering dropped in favor of raymarching, this change comes with :
      • Better performances
      • Higher overall quality
      • Ability to render clouds from any angle
      • A whole bunch of variables to get an higher control over performances and quality
    • Ability to skip heavy calculations of 1/2 or 1/4 of the screen in a grid to help performances
    • Screenspace shadows
    I added stuff to the first post as well to reflect those changes.
     
    punk likes this.
  13. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    There's a known bug where Mac and OpenGL platforms don't compile, the fix is being uploaded to the asset store right now, sorry about that guys !
     
  14. Arainami

    Arainami

    Joined:
    Dec 2, 2014
    Posts:
    11
    Hello! I just bought this asset. By the screenshots and video, it looks amazing. But when you import it into Unity 5.2.3p3, 5.3.4f1 and 5.4.0 (beta) both materials look like this:


    I follow the instructions in PDF, and when I run the scene - I see only a pink screen. This problem is also repeated on my second PC. What could be the problem? There are no errors in the log. I also tried to import asset in a new project - the same result.
     
  15. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    As I said right above your message, Mac and OpenGL won't compile, you can also add to that list shader models under 5.0. A fix is already coming, you'll have to wait for the asset store guys to accept the submission.
     
    Arainami likes this.
  16. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    181
    Hi ! I come back again because since i merge my porject to an news one i have with your shader when i bluid this one.

    Inside the editor any problem, all works perfectly :



    BUT when i compile the project and launch that's what happen :


    All the shader mesh turn black :(.

    Do you have a idea ?

    PS : I dont use your last version because i can't update my project to the last version of unity
     
  17. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi !
    The last version works on pretty much every version of Unity above 4.0 (the first post is up-to-date, requirements posted there are accurate as of the latest version), "Requires Unity 5.3.4 or higher." is an automated message created by the asset store based on the version you uploaded the package with.
    Now that you're talking about it, I should probably mention that in the description of the store, thanks for pointing that out !

    Those four lines that the console prints out aren't related to the shader so I can't tell what goes wrong, I suppose that the entirely black rendering is probably just a replacement shader being rendered but that's about it.

    Well, anyways, it would be best to switch to the newest version, supporting the old one isn't really feasible.
     
  18. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Heya,
    Picked this up for a separate project and am very happy with it but was thinking about using it for a VR project as well.

    I expect this will be too heavy for my VR project but I'm seeing around 6ms-10ms on the GPU. I can optimize down to 2ms but the effect starts looking pretty bad.

    Are these numbers consistent with what your seeing on your side. I noticed .5ms in one of your screen shoots but I was expecting that was not accurate as it was not the profiler.

    Thanks!
     
  19. WilliamNiira

    WilliamNiira

    Joined:
    Jun 28, 2015
    Posts:
    5
    Hey!
    I bought the asset right now, and I started testing it, but there is a visual thingy that looks kind of horrible.



    Not sure why this has happened.. I hope you can help me!
    Thanks in advance,
    William
     
  20. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi,
    Well, performances varies wildly between camera point of view, material variables, screen resolution and GPUs.

    For comparison :
    Unity 5.3.4f1 using Dx11 without VSync
    980ti using latest drivers,
    frametime using the high quality preset on an empty scene is CPU bound and the blacksmith scene never dips below 90 fps at 1080p.

    Did you try the low quality material preset ? How does your 2ms material looks like ? What GPU are you running this stuff on and what specs are you targeting ?
     
  21. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi,
    You are talking about the darker tones I suppose ? Make sure that you are in linear color space and modify the variable named "Step near surface" on the material, you should probably look at the Raymarcher section inside the online guide to properly understand what you are doing with those values.
     
  22. WilliamNiira

    WilliamNiira

    Joined:
    Jun 28, 2015
    Posts:
    5
    When modifying the "Step near surface" everything looked awesome! Thank you for taking your time explaining it!

    Keep up the good work.
     
  23. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Any word on the shaderforge ray marching tutorial? I`ve been trying to work it out for weeks, so your superior knowledge in this are would be really helpful.
     
  24. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Hi,
    I'm targeting a GTX 970 at 90fps giving me 11ms per frame on the gpu.

    I got it down to around .7ms-1ms. using the low quality material and it still looks pretty good. I may be able to handle the 1ms hit to perf as I'm using the clouds as a sort of ground plane (combined with a fog not shown in the image below)

    I am having a problem where the draw distance seams to be clamped at 1000 regardless of what I set it at. You can see how the clouds don't render to a distance of 5000 as my camera does. This becomes apparent when the camera gets far about the clouds as in the image below. Any thoughts on how to increase the draw distance?
    Clouds.PNG
     
  25. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi,
    I am halfway through it, I can't give you an exact ETA on it but it shouldn't take too long.
     
  26. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    That might be because LODs are too low to render anything, try modifying LOD base and offset or it could also come from the fact that the rays stop before reaching that far, increase your "Steps Max" and see if that changed anything.
     
  27. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Welp, have a look and tell me what you think : Raymarching using shader forge
     
  28. astrellon

    astrellon

    Joined:
    May 1, 2016
    Posts:
    2
    Just bought the asset, everything looks great in the editor camera but nothing is rendering in the game camera. Pretty much everything is at default from stock scene for the camera and I've tried moving the camera closer to the clouds just in case it was a distance issue. Also no difference when built to .exe. Any help would be greatly appreciated.

    upload_2016-5-1_17-22-2.png

    Thanks.
     
    Last edited: May 1, 2016
  29. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi,
    If you put a plane or quad right in front of your camera and put the material on it, is it working ?
     
  30. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Thanks. great to have a place to start. i`ll have a look. what would be useful is actually including the code though ;)
     
  31. astrellon

    astrellon

    Joined:
    May 1, 2016
    Posts:
    2
    So I got around to trying my project with the asset on my laptop where everything worked as expected. I then went back to my desktop restarted Unity and everything was fine as well. Perhaps it was just an issue where Unity needed to restart after downloading the asset, thanks for you help though.

    I still tried putting the material on a quad, interesting effect, wouldn't have though to put it on another object.
     
  32. Dandolittle

    Dandolittle

    Joined:
    Jul 2, 2013
    Posts:
    17
    Hey so been a long time user of your cloud asset and was so excited to see this update however im having issues when ever i import it. the material above is pink and i get the following errors.
    im using version 5.2.3f1 i tried redownloading the asset and reimporting with no luck. using DX11 on windows 8
     

    Attached Files:

  33. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    That's weird, if you create a new material instead of relaying on those supplied does it work properly ?
     
  34. Dandolittle

    Dandolittle

    Joined:
    Jul 2, 2013
    Posts:
    17
    No luck sadly. At first it refused to let me attach any texture to the material though restarting unity i could there after followed by the warnings i previously posted. i will try a few other things to see if i can fix it but im currently stumped as to whats happening
     
  35. Dandolittle

    Dandolittle

    Joined:
    Jul 2, 2013
    Posts:
    17
    Well i updated unity which fixed the issue completely. Could be version specific
     
  36. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Thanks again for the wiki marcher tutorial, but i have to say i cant really see the point in posing questions in it. if many shader forge users are like me, then they don`t know how to program the features you are posing, and thats the main reason why they are using shader forge.
     
  37. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Well, that's a relief !
    Some users are using it to prototype shaders before hand writing them, it was never meant for beginners.
    I still tried to explain it as thoroughly as I could but I can't hand hold you through basic vector maths and shader programming, once you know both you'll be able to get the gist of it through this tutorial and create your own raymarched stuff.

    Jumping from SF to shader programming isn't that far off and it's kind of the natural path that you will have to take if you want to create complex shaders.
     
  38. GMM

    GMM

    Joined:
    Sep 24, 2012
    Posts:
    301
    The asset seems very cool under Unity 5.3.4f1, but is there an ETA on when a 5.4 compatible version might be availible? Like Arainami, i'm getting the Pink shader error.
     
  39. Chaerephon

    Chaerephon

    Joined:
    Jan 3, 2013
    Posts:
    8
    Hi Eideren,

    I love the new clouds but my draw distance also appears clamped at 1000 in my project and the LOD and Steps Max did not change it, any other ideas what could be doing this?

    Also is there any way to define density areas? Perhaps I could use in conjunction with your previous sliced-based clouds.


     
  40. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi !
    Sorry about the draw distance, I just verified that and I F***ed up my maths when calculating the distance blend, I'll upload the new version in one or two days to give me enough time to maybe squeeze in a new function.

    @Chaerephon I could let you control size or density through a texture in world space, how does that sound ?

    I'll provide support to 5.4 once it's out of beta, trying to fix something that might roll back or is caused by an unfinished state of a unity function is pointless. Ho well, if you provide me with what your console spit out I'll look into it.
     
  41. GMM

    GMM

    Joined:
    Sep 24, 2012
    Posts:
    301
    Completely understandable, i'm not expecting support for it right now.

    When i import the asset, i get the following shader error:

    Code (CSharp):
    1. Shader error in 'VolumetricCloud': 'ShadeSHPerPixel': no matching 3 parameter function at UnityGlobalIllumination.cginc(126) (on d3d11)
    2.  
    3. Compiling Vertex program with DIRECTIONAL SHADOWS_OFF LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF
    4. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING
    Replacing the cginc shaders in the "Scrips" folder with the new built in shaders for Unity 5.4 will remove the error, but the effect is not shown in the scene.

    Thank you for the response, looking forward to toying with the asset in the future.
     
  42. Chaerephon

    Chaerephon

    Joined:
    Jan 3, 2013
    Posts:
    8
    Thanks for the quick reply, controlling density with a texture would be AMAZING! As you can see Im displaying the clouds from a very high altitude so being able to restrict them to certain areas will help sell their believability. I'm using DEM data for the map so I could even use real world weather patterns to generate the distribution.

    Not sure if this helps but the shadows draw distance appears uncapped in this version.
     
  43. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    That wasn't related but thanks anyway ! It was an easy fix once I knew where it came from, don't worry.

    I just finished the texture controlled density, I'm currently cleaning up the code and optimizing it further, I'll upload the new build tomorrow.

    Seems like Unity changed their GI functions. Thanks for the post, I'll take a look !
    "UnityStandardCore.cginc" is a modified version of the original so overriding it will break the shader.
     
  44. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Version 2.1 has been uploaded. As always, you'll have to wait for the asset store guys to review it, here's the changelog :

    // Version 2.1
    Fix :
    • Issues with draw distance being capped at one thousand.
    • Toggle drawer drawing incorrectly on first inspector draw.
    • Lighting issues caused by very high cloud density.
    Added/Modified :
    • File replacement for Unity 5.4+
    • Texture based density.
    • Modified light attenuation inside clouds and exposed controls for it.
    • Further cleaned up the code.
    • Slightly reduced branching as well as operations on shadow sampling.
     
    Chaerephon likes this.
  45. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    could you just say you don`t want to do it and not be condescending. its not about explanation. theres plenty of explanation available, its about implementation. i can regonise the code well enough but as it is the code you supplied is fairly useless. if it was designed for somebody with all the abilities of a shader programmer, then why is it on the shader forge site? where the only way to improve it is to program more stuff. surely a slightly expanded code that accepts a worldspace density, and colour input would actually be useful to people, instead for catering to the slim minority who use shader forge but also can program shaders, and dont need the dumbed down version. I`m sorry if this sounds ungrateful, but you do already have my money.
     
  46. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    I don't think you understand the basic premise of raymarching at all. Ray marching is all math and shader programming. If you don't need it dumbed down then take the framework he gave you for Shader Forge and start working through http://www.iquilezles.org/www/index.htm because that's all there is to it. You might be able to adapt some of the basic distance functions to Shader Forge nodes. Since Shader Forge doesn't support groups, it's going to make quite a mess though.
     
  47. Dandolittle

    Dandolittle

    Joined:
    Jul 2, 2013
    Posts:
    17
    Hey Eideren,
    recent update is much smoother and makes flying through clouds so much better but the render queue option in the shader doesn't seem to change anymore as it did in the previous version.
     
  48. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    I just checked and it should work fine. Inside the editor or in build ? Could you try out this script and check if the queue is correct ?
     

    Attached Files:

  49. Dandolittle

    Dandolittle

    Joined:
    Jul 2, 2013
    Posts:
    17
    So used the script and attached the material. as you can see it remains the same. this is all done in the editor for me i havent tested a build
     

    Attached Files:

  50. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Alright, could you backup the VCloudShaderGUI inside VC2/Editor and put this new one in his place ? That should give us a log of what happens
     

    Attached Files: