Search Unity

Volumetric Clouds

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

  1. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Unity seems to be doing some weird stuff when drawing editor handles, I sent you a PM with a potential fix, try that out and tell me if it resolved the editor slowdowns.

    Most of the properties will influence that issue, you'll have to play with them but yes, changing near surface steps might help if you set it too low.
     
  2. nfaber

    nfaber

    Joined:
    Apr 5, 2018
    Posts:
    1
    Hi,

    I've purchased the asset for use in VR with HTC Vive , but each eye has different shadows.
    I saw other people noticed this as well, have you been able to figure a way to circumvent this issue?
     
  3. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hey,
    I sent you a PM with a potential fix, check it out
     
  4. Cleverrus

    Cleverrus

    Joined:
    Apr 21, 2015
    Posts:
    4
    Hello, I recently buy your asset but I have issue with it, the shader isn't compiles, I use unity 2018.2.0b2 here screenshots of console error. I will appreciate your help, it it's possible to use it in 2018 offc.
    Screenshot https://imgur.com/a/edC8LzV
     
  5. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hey guys, here's the change log for the upcoming version, minor changes mostly besides the VR fix :

    // Version 2.5
    New features :
    Shadows fades off into the distance based on the distance blend parameter.

    Fixes :
    VR rendering.
    Handle cap under unity 5.4.
    Updating NormalizePerVertexNormal to Unity 2018.2b's pattern.

    _____________________________


    I just fixed it and sent it to the asset store, if you need it ASAP contact me and I'll provide you with that version.
     
  6. Cleverrus

    Cleverrus

    Joined:
    Apr 21, 2015
    Posts:
    4
    thx for answer, I will wait till it appear on store, appreciate your help)
     
  7. kilian277

    kilian277

    Joined:
    Jul 13, 2012
    Posts:
    54
    Hi there,

    i purchased your product a while ago , no today i saw you had an update so i reimported the package and used the Raymarched clouds , but they never show up.
    The console does report this:

    Shader error in 'Cloud/Standard': syntax error: unexpected token ';' at line 326 (on d3d11)

    Compiling Vertex program with UNITY_PASS_FORWARDADD POINT
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR


    It's VR , uses DX11 , Deferred also.
    In your other version if have the same error it throws on that shader.

    Thanx.
     
  8. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hello,
    What version of unity are you running on ?
    The line number specified in that console output seems to have been mangled ; the line at 326 hasn't changed in more than a year and works as expected.
    I also verified nine different versions of unity above 5.0 (including 2017 & 2018) under dx11 deferred and none of them failed, could you try running it in a clean project ?

    What do you mean, could you rephrase that ?
     
  9. kilian277

    kilian277

    Joined:
    Jul 13, 2012
    Posts:
    54
    I'm using 2018.1 , i'll try to import it in a clean VR project.
    I meant the original version before the raymarched version , like i said i have this package from 2016 i think the other one i was using or earlier.
     
  10. kilian277

    kilian277

    Joined:
    Jul 13, 2012
    Posts:
    54
    Okay , in an empty project the rayamrched clouds work perfectly, it must have been f***king up with a previous version of the asset or something , ill try to remove the package and reimport.

    EDIT:::

    It works now ! , i had to reimport the whole package again after deleting everything, and set the queue to a higher number ,because i was using our custom dynamic time of day skydome , it was rtendering behind it.

    Also can we control the shapes of the clouds with multi layers like in horizon zero dawn paper where they describe using more puff on the bottom and more clunky , spherical layer on the top to simulate the towering clouds ?
     
    Last edited: May 29, 2018
  11. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Not really, you can put two different instances on the same camera using different heights and density to emulate those layers.
     
  12. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    130
    Afternoon, im very interested in this asset for VR use, im curious is it possible to add more volume to a cloud, iv noticed in the video clips i could find all clouds are at the same height, can the clouds be morphed into different shapes?
     
  13. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hey,
    You can change their overall density through the inspector and modify the texture itself to change their shape and density.
    Yes, each instance as a specified height around which they render, you can place more layers at other heights though.
     
  14. TimBurnstone

    TimBurnstone

    Joined:
    Nov 16, 2012
    Posts:
    9
    Just purchased the asset and couldn't wait to try it out. Followed the manual exactly and got this:
    brokenclouds.jpg

    Its hard to tell from the video and the screenshots in the thread, but I don't think those 'breaks' in shading are intended. Adjusting the material settings doesn't seem to help, aside from the NormalMap Settings, which just turn off the shading completely.

    Any help?
     
  15. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hey,
    Your steps are too large, I updated the online manual with more in depth information about the raymarcher, that should help you solve this issue.
     
  16. TimBurnstone

    TimBurnstone

    Joined:
    Nov 16, 2012
    Posts:
    9
    I appreciate the reply and the update to the manual, with the diagram and all. I'm familiar with the premise, it's quite similar to a raytracing voxel traversal algorithm I wrote a while back. I'm just having trouble with finding settings that don't produce the artifacts I'm seeing. Tried bringing the step size all the way down to 0.0001 without remedy. Adjusting the step max and skip to compensate didn't work. Tried changing the color space from gamma to linear, didn't help. The only thing that seemed to work, though not quite well enough, is to throw the cloud transform thousands of units into the sky and crank up the camera's draw distance to something ridiculous, but that only helps a little, and it's not ideal for what I need.

    I'm really afraid it's something on my end. the screenshot I attached didn't quite do the problem justice, the jpeg compression blurred things. Not quite sure what to ask for, I wish the asset came with a small demo scene. The default settings of the material alone look terrible on my side. At the end of the day, it's only 10 bucks. But it's a shame, my game has a somewhat cel-shaded look, and these clouds would've been absolutely perfect.
     
    Last edited: Jun 22, 2018
  17. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Did you try the other material ? The preset you are using on your screenshot looks like the low quality one, the other one should be less prone to this issue.

    In the mean time I'll try to see what I can do to reduce those.
     
  18. TimBurnstone

    TimBurnstone

    Joined:
    Nov 16, 2012
    Posts:
    9
    I've tried both. Should there be a difference? If I give them identical material parameters, they look identical.

    Edit:
    Been playing with this for hours, messing with material settings trying to find any combination that fixed this issue, even a little. After finally giving up, I checked the settings on the RaymarchedClouds script itself and found that adjusting the Plane Offset greatly affected this issue. Here's a before and after:
    betterClouds.jpg

    You can still see a hint of the issue, but it's so much better. Again the only thing changed between these two screens is the "Plane Offset" value, in case anyone else is seeing this issue.
     
    Last edited: Jun 22, 2018
  19. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    They are just different preset since they use the same shader.
    By increasing the plane offset you are effectively pulling back the exponential curve used to control the step size with "step skip" since it starts at that virtual clipping plane position, that's most likely what's happening here. This is not really a solution if you want fly through though.

    I'm re-writing most of the cloud rendering at the moment to see if I can work around this, give me a couple of days and I should be able to get back to you with something better.
     
  20. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    I should be done tomorrow or the day after, here's the result with 20 steps :
     
    Aniow likes this.
  21. mgto

    mgto

    Joined:
    May 30, 2013
    Posts:
    22
    Hi Eideren,
    may I suggest a fix:

    Code (CSharp):
    1.  
    2. void CreatePlane(ref GameObject planeGO, string defaultName)
    3. {
    4.      ...
    5.      planeGO.SetActive(enabled);
    6. }
    7.  
    I disable the raymarcher directly after setting it up and without the fix the planes are created enabled. So I would have to enable and re-disable the raymarcher. The fix makes sure the planes are always in the correct state. Everything else is then done by your code in OnEnable() and OnDisable()

    cheers!

    ps: maybe also make sure the stuff in OnDrawGizmos is just run if the editor cam is really set as attached?
     
  22. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Alright, here's the change-log for this new update :

    /!\ There are breaking changes, you will have to re-configure your materials after updating /!\

    // Version 3.0
    • Rewrote the raymarcher entirely resulting in lower amount of steps required to render in the same or at a higher quality.
      • "Step Skip" and "Step near surface" have been replaced by a single different "Step Skip" property which adapts far better to cloud volumes.
    • Most of the lighting as been re-written as well and as such properties related to those have all changed how they influence rendering, affects the following properties: base color, shading color, normal map, normalized and normals intensity.
    • "Depth intensity" has been changed to "Sky Light Attenuation" and expanded into a color property.
    • Indirect lighting is now independent of the normal-map switch since it is no longer influenced by it.
    • New property : "Post Blend", Controls how Distance Blend is computed, refer to the manual for more information.
    • New property for Screen Space Shadows : "Blend out of shadowmap", toggle to filter screen space shadows out of the shadowmap.
    • New property for Screen Space Shadows: "Volumetric", toggling it on makes shadows behave like previous versions, off will just use a projection instead which is far cheaper and slightly worse looking.
    • Renamed Density to coverage, it more accurately represent what the property controls.
    • Renamed alpha to density, same as above.
    _____________________________

    You should be able to run both versions at the same time to ease in the transition, just don't overwrite the old version with this new one.

    Since this new release has breaking changes, I made a new manual instead of updating the old one, you can find the online version here : https://docs.google.com/document/d/1ienN9UwN7q-1B5k--mxEw_PWhtQpDSddfQBcSYG45vc/edit?usp=sharing

    As always, it'll take unity a couple of days before the update is live on the store, if you need it asap send me a PM or email.


    Hey,
    That makes a lot of sense, I added it to this update.

    As for OnDrawGizmos, I'm using it to gain access to the scene camera and it's the most straight forward event for that. OnValidate would be the best balance of use-ability and performance but we can't destroy any unity object from it and we would have to fetch the scene camera through UnityEditor.SceneView which is very unreliable.
    The function running inside there are fairly light and it's not even called inside builds so I would rather leave it as is to keep the script as simple as possible.

    Thanks a bunch !
     
    Aniow likes this.
  23. KeydareProject

    KeydareProject

    Joined:
    May 27, 2017
    Posts:
    5
    Hi,
    i have upgraded my project from 2017.3 to 2018.2 and the shader show me this error

    Shader error in 'VolumetricCloud': cannot implicitly convert from 'const half3' to 'float4' at Assets/VolumetricClouds2/Scripts/VolumetricCloudsCG.cginc(74) (on d3d11)

    Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL Y_AXIS
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUMEUNITY_LIGHTMAP_RGBM_ENCODING

    Can anyone help me?
    Thanks
    Fabrizio
     
  24. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hello,
    You just have to update to the latest version, that issue has been fixed a couple of updates ago.
    Have a nice day !
     
  25. KeydareProject

    KeydareProject

    Joined:
    May 27, 2017
    Posts:
    5
    Hi,
    thanks and sorry but Unity didn't want update the plugin. Now it works but with realtime night and day cycle now during the night when the ambient color turn to blue the clouds remain white. It seems like before update, the shader took the ambient color, now only the main light color (during the night there is the moon light). Any suggestions?
     
  26. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Verify that 'Advanced Lighting' is toggled on and 'Indirect Lighting' has a value greater than 0.

    If it still doesn't work : I'm sampling the skybox's reflection probe instead of light probes since I can get more data out of it, it might be sampling from a reflection probe in your scene though if you are under Unity 5.3 or your time of day might not change the skybox/draws in front of it ?

    Now, direct lighting will still be visible even without any indirect. While I don't think that's aesthetically pleasing, I changed the contribution to reflect more closely to how unity deals with it on your models. I thought you guys would prefer to keep the cloud's lighting consistent with your geometry's light model, I could implement a switch if you want.
     
  27. KeydareProject

    KeydareProject

    Joined:
    May 27, 2017
    Posts:
    5
    Thank you for response, but If it's not asking too much is it possible have the old shader to achieve the same apperance of V2? With your plug-in i've created awsome clouds but now that style has gone away..

    I tried to replace the old v2 but, even if it not show any error, no clouds appears.

    Same setting for old and new shader, same perlin noise texture (yours), no changes of lights parameters (GI, Ambient, Script etc.) all untouched.
    1. Daytime: splendid cartoon color, with smooth edges.
    2. Daytime now: hard edges, even if i change the perlin texture.
    3. Night before: automatic take of the ambient light.
    4. Night now: bright clouds..

    With the old shader i've set Indirect Lighting to 1.05, but if now i leave identical this parameter the clouds looks yellow.
    This is a screenshot of my setting right after Unity update of the V2, to save the material parameters.

     
  28. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Alright, so I mentioned a couple of posts above yours that v3 entirely changes the look of the clouds when keeping the same material configuration, I should probably have made a more obvious message when importing the asset, my bad.

    Since there are more issues than initially planned here's what we could do :

    I send you a v2 which already fixes the error that you initially mentioned, but since you won't be able to update, you won't have any bug fixes and features coming from this version and the next ones.
    -or-
    We setup a screen-sharing session and I'll try to fix / guide you through setting up your material correctly and potentially implementing custom rendering code for your case.
    -or-
    You send me your time of day system and what you want your clouds to look like and I'll send you back a material which matches that for this version.

    Which one would you prefer ?
    If you have another idea, let me know.
     
  29. KeydareProject

    KeydareProject

    Joined:
    May 27, 2017
    Posts:
    5
    Thank you for your rapidity and sorry for my insistence. I understood that the v3 change the entire look of the clouds, but for this reason the best is to maintain the compatibility. I purchased the asset 5 months ago and after worked on it's parameters many days to obtain the style i had in mind i started to consider the deal closed. Now it's reopened, but you are very available and if you can send me an old version i will consider me very happy. I would be very happy (and even all your customers, i think) if both versions could be supported for the future, avoiding "custom" versions that will be obsolete again in 4-5 months. We are very close to publish our game, where we avoided to buy many third-party asset just to avoid these problems. But your clouds was so awsome that we did not let them escape.
     
  30. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    No biggie, I sent you a PM with links to the older version.

    The last breaking version was about 2 years ago I think, I felt like that version had run its course and it was time to rewrite parts of the code. I'll try to find the time to create a script to port old materials to this new version and try to port old features to it, I just can't support two different versions.
     
  31. KeydareProject

    KeydareProject

    Joined:
    May 27, 2017
    Posts:
    5
    Thank you so much! Yeah, i know, support two version it's obviously too heavy and what you wrote looks the right way to go on. Thanks again.
     
  32. amarillosebas

    amarillosebas

    Joined:
    Feb 28, 2013
    Posts:
    42
    Is there a way to have multiple layers of clouds?

     
  33. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    You add a second script to your camera and assign another material to it with the settings that you want. You'll have to tweak the values of the material's render queue to render them in the right order though.
     
  34. amarillosebas

    amarillosebas

    Joined:
    Feb 28, 2013
    Posts:
    42


    Changing those two values, on both materials, has no effect. Only one set of clouds renders, making the other one disappear. I'm using Unity's Post-processing Stack and the default procedural skybox.

    Edit: Also, there's a considerable FPS drop in the editor when adding a second script.
     
  35. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    I just pushed a bunch of fixes to unity's asset store team, those issues should be fixed once you update. If you need it ASAP, send me a PM.
     
  36. Dolzen

    Dolzen

    Joined:
    Mar 26, 2014
    Posts:
    90
    Hello Eideren, I would like to ask if this asset supports spherical worlds since my terrain is a planet and I'm looking for a volumetric clouds solution like yours, thanks.

    Edit:
    I ended up buying your asset because I read that it does work with spherical terrains, but I have two major issues now:

    1.- The lighting of the clouds in the "dark side" of the sphere (or planet) is not as expected, since light is not supposed to reach that place the clouds should be dim but they are not.
    2.- A ugly seam along the sphere from north to south is popping up, Im using Spherical Mapping, I know that by using a 2d texture projection into a 3d sphere will cause some deformations in the poles and it is ok, but a seam along the sphere is not expected.

    Everything else is working good and it is a beautiful shader, any help would be appreciated, thanks.

    Edit 2:
    I solved both issues :)
     
    Last edited: Aug 14, 2018
    DenisGLabrecque likes this.
  37. Breezebuilder

    Breezebuilder

    Joined:
    May 4, 2017
    Posts:
    2
    Would you mind documenting how you solved the above issues? I'm facing a similar problem.

    Edit: To add onto this, is there any documentation of the 'split shadow rendering' option?
     
    Last edited: Sep 4, 2018
  38. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hey,
    For the first issue I don't really know what he's referring to but for the second one you either have to toggle "Spherical>Spherical Mapping" off or set the tiling to a value which hides the seam ( multiples of 65.45 works well, 523.6 for instance )

    The "split shadow rendering" option uses a second material to render the screen space shadows, this gives you the ability to change the render queue of only the shadows to render them in front / behind other objects.
     
  39. Breezebuilder

    Breezebuilder

    Joined:
    May 4, 2017
    Posts:
    2
    Thanks for the response. My clouds are tiling nicely now, and I've managed to 'fake' shadowed clouds behind my planet with a point light on the sun side.

    I've also come upon what I think is a bug - with plane alignment set to X_AXIS or Z_AXIS, the point light sources are incorrectly calculated and the lighting direction is wrong. The Y_AXIS setting works fine.

    Is there any way to have screen space shadowing play nicely with other shadows, rather than add on top and further darken already shadowed areas? As i understand it, they're just fake shadow projections rendered on the surface?
     
  40. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Thanks for pointing out that bug, I'm taking care of it.
    The toggle "Blend out of Shadowmap" should help with shadows blending.
    You have two different shadowing techniques here, the non-volumetric which is very much like unity's shadows : getting the geometry's depth in light space and testing it against other geometry's depth ; and the volumetric mode which works in a way closer to real light : traveling through clouds and using its opacity to compute the shadowed regions.

    I won't implement a path to render to unity's shadowmap directly since they will then be limited to unity's shadow resolution and draw distance.
     
  41. Dolzen

    Dolzen

    Joined:
    Mar 26, 2014
    Posts:
    90
    Hey there, I noticed that you already solved both issues but I will document my solutions since they are different than yours and might work better for you.

    1.- If you wanna have shadowed clouds behind your planet without faking them, you need to open Assets\VolumetricClouds3\Scripts\VolumetricCloudsCG.cginc and add the following code right before:

    Code (CSharp):
    1. return final;
    at the end of the script.

    Code:

    Code (CSharp):
    1. #if _SPHERE_MAPPED
    2.         final = clamp(dot(upDir, light.dir), 0.1, 1) * final;
    3.     #endif
    This will add a simple sphere shading to the clouds.

    2.- If you wanna have nice tiled clouds with "Spherical>Spherical Mapping" turned ON, then you have to set Tiling under Dimensions in the shader settings to 1256.6.

    I hope it helps.
     
    Last edited: Sep 8, 2018
    DenisGLabrecque likes this.
  42. scourgey

    scourgey

    Joined:
    Jan 5, 2014
    Posts:
    17
    I've bought this asset, I want to pause the clouds so they stop animating when I pause the game.

    Is there any way I can do this @Eideren ?
     
  43. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    You can set the material's "Speed" and "Speed Second Layer" to zero
     
  44. scourgey

    scourgey

    Joined:
    Jan 5, 2014
    Posts:
    17
    Thanks I've tried that, but when I do that, the clouds teleport to a different location before stopping. Is there any way to do it without causing the clouds to teleport?
     
  45. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Well, the initial solution would be to reduce unity's Time.timescale to zero or near zero instead since clouds animation are based on that but that might not work in your setup ?
     
  46. scourgey

    scourgey

    Joined:
    Jan 5, 2014
    Posts:
    17
    Unfortunately that doesn't work in my case, as I still perform animations when the game is paused, so the timescale is still set as 1, but just that the physics of in-game objects are paused.
     
  47. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Well, if you're willing to put in some work you can replace unity's time variable by yours :
    On line 42 of VolumetricCloudsCG.cginc add the following line
    f1 _MyCustomTimeVariable;

    On line 337 of the same file replace '_Time.g' by your variable name (in this case _MyCustomTimeVariable)
    Now you can set that variable's value from a C# script through
    Shader.SetGlobalFloat("_MyCustomTimeVariable", yourTimeFloatValue);

    Where 'yourTimeFloatValue' is a float that you increase by delta time while the game is running / don't increase anymore while the game is paused.
     
  48. scourgey

    scourgey

    Joined:
    Jan 5, 2014
    Posts:
    17
    Thanks Eideren, this works, it does mean I need to run

    Code (CSharp):
    1.  
    2.             timeCount += Time.deltaTime;
    3.             Shader.SetGlobalFloat("_MyCustomTimeVariable", timeCount);
    4.  
    every single time the update function is called, which isn't ideal. But for now it will work!
     
  49. gaiastellar

    gaiastellar

    Joined:
    Nov 8, 2013
    Posts:
    56
    Hi, can these cloud be used in any other situtions apart from unity terrain? For example on spherical planets, or in space for a nebula type effect?

    Thanks
     
  50. gaiastellar

    gaiastellar

    Joined:
    Nov 8, 2013
    Posts:
    56
    hi,
    is this limited to working with unity terrain/ flat scenery? im working on full size planet terrain and looking for a clouds solution that will work on spherical terrain?

    thanks
     
unityunity