Search Unity

Volumetric Clouds

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

  1. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hey, it depends on how much work you are willing to go through, by default both materials are setup to render like this asset's video, if you have more talent than I do with image editing software you could modify the default texture used to generate clouds or create another one in a 3rd party app' to get a result closer to real clouds (my texture is a perlin noise on the alpha channel and its normals in RGB), there's a very extensive list of variables to control how clouds are lit and shaped, you could take a look at the manual to find out if it is enough for you. Still, you probably won't be able to make an exact or better replica than your video since my volume is 2D projected onto 3D whereas they have a native 3D one but you could get quite close.
     
  2. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Hello,

    I'd just like to add a +1 to this. This asset would be perfect for my project if it worked with an arbitrary "up" axis.
     
  3. amarillosebas

    amarillosebas

    Joined:
    Feb 28, 2013
    Posts:
    44
    Can you animate the cloud material density? How?

    Edit: I had to do it as a video edit, but this was what I wanted to achieve:
     
    Last edited: Apr 22, 2017
  4. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi, yes, like you would any other material ; create an animation clip + an animator, drop them on the camera, reference the plane's renderer in the clip's properties, add the material's density to the curve and animate it however you see fit.
    You might need to uncheck the "Hide Plane" under the C# script if unity can't seem to find it once in play mode.

    Perhaps in a next update, I have tons of stuff to do right now and that requires a fair amount of work if I don't want to break other functions.
     
  5. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
    I am seeing a SIGNIFICANT drop in performance when enabling VR. The framerate drops to below a tenth. This is running Unity 5.6 in single pass rendering. Using Volumetric Clouds 2.3. Any pointers on what might be the issue?

     
  6. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    What type of GPU do you have?
     
  7. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
    a nVidia 980 GTX Ti
     
  8. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Same as me, I'm using 5.6.1. It looks like you're GPU bound, but I'm able to run clouds, volumetric lighting, post stack in VR plus my whole game on my Ti, are you using a really large cloud size? Especially height and do you have any other effects? Also what scale are you rendering the VR at?
     
  9. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
    • Native res (1:1 scale),
    • no volumetric lighting,
    • no post stack other than bloom (with HDR),
    • draw distance is in the low 500s for the clouds,
    • 2 point lights,
    • height is not anything crazy .
    • No shadows,
    • no terrain.
    • The only elements rendering are the clouds.
    It runs 500-800 fps in non-VR, 40s in VR. Seems like a bug more than anything.

     
  10. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    I'd play around with the ray marcher settings, you can balance the performance against visual payoff, you can get away with a much lower max step, I'm getting pretty good results in VR using the settings below, hope it helps

    clouds.jpg
     
  11. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
    Max step reduction or no, there is no reason I should see a dramatic drop to this magnitude. I'm not exaggerating when I say that the level runs above 500fps with these clouds only to drop to the mid 40s when VR is turned on.
     
  12. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    I do have the same GPU as well and tried to run it through a camera using a render texture of 1080*2 pixel width by 1200 height since I don't any VR devices and, even by using your settings and viewing angle, can't reproduce your issue.
    Could you try out the files I sent you in PM to find out if it is resolution related or VR related ?
     
  13. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
     
  14. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
    Could you resend them? Not seeing them.
     
  15. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    if you are GPU bound the CPU will wait for the next vsync which in VR would show up as about 40 fps in the editor, so it's certainly possible for it to appear like you're dropping from 500 to 40 fps, if you look at the profiler and you see it doing gfx.WaitForVsync() on the CPU, then you are GPU bound ie your GPU can't keep up with the refresh rate which in VR is 90fps. So usually 40 fps is a real good give away for being GPU bound in VR, it may not be the case, but its worth checking out, you might be just tipping over the edge, I've been caught out a few times by that. :)
     
  16. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Yep, thanks a lot for trying to help him while I wasn't here by the way ! With the files I sent we should find that out.

    Sorry about that, I was really tired and tried to help you before going off, check your PMs.

    If it is fillrate related then It is still very weird that you can't reach a playable framerate. While even GPUs under the same version aren't equal, such a massive difference in performances is very weird. It sounds like your GPU could be underclocked ? If the resolution thing shows the same framerate then could you try out one of those gpu comparison services like userbenchmark or similar to compare your cards against similar versions ?
     
  17. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    ;)
     
  18. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
    Tried the new files but its a no-go. My GPU isn't under clocked and I checked for thermal throttling.

    The profiler is showing a repeating spike when the clouds are enabled but there isn't any details when I dig in. As you can see I have the clouds set to an extremely low quality value.

     
  19. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    What do you mean ? What happened with the resolution setter I gave you, Where the average fps as low as with VR ?
    A deep profile and adding the GPU usage profiler instead of CPU might provide more information, check-out Render.Mesh under GPU/Camera.Render/Drawing[...] to verify that it is rendering only once.
    Did you include a bunch of point lights to be rendered with the clouds, that'll increase frame time even more, or was it just for testing ?
    Is the editor rendering clouds as well ? In most cases unity will just skip the editor camera's rendering if it isn't on screen but we never know.
    On my system, those spikes are caused by a sudden jump of around 50 new meshes inside the memory profiler and happens even in an empty scene, could you check the memory out to see if it is related ?
     
  20. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
    1 is with VR off
    2 is with the res setter active
    3 VR active and res setter off
    4 VR active, res setter off, render memory details
    5 more details on memory

    We see the expected difference in performance when VR is simulated with your ResSetter script but this doesn't match what happens when a real HMD is used. You can see in the 3rd screenshot that the "other" section in the GPU profiler is at 8.8ms when VR is ON while its 0.8ms when VR is turned off but still using ResSetter.

    Also, memory seems to be changing drastically in VR than with the ResSetter
     

    Attached Files:

    Last edited: Jun 9, 2017
  21. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Well, sorry but I can't help you there, it's not directly related to my asset. The source "other" is either caused by those huge mesh creation and destruction or something else internal to unity. I don't have anything that uses the GPU outside what would fall under transparent rendering, I'm not spamming new mesh components either, only creating one when we don't have any and that's about it.

    You should send your project to Unity's support, if you don't have the time/don't want to I could do it instead but you are in the best position to properly answer their questions since I can't reproduce it.
     
  22. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    Hello, first thanks for your work it's really good ! Is there a way to get a spherical progression of the clouds instead a plan ?
     
  23. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hi,
    I'm not familiar with that term, you want clouds to be mapped around the sphere in something similar to unity's sphere uvs ?
     
  24. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    Exactly ! I would set the origin of the sphere to [0,0,0] and choose a radius to have clouds moves around my level.
     
  25. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
  26. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
  27. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hello everyone, a new version has been uploaded to the asset store, here's the change log :

    // Version 2.4
    Additions/Modifications :
    Implemented spherical coordinate mapping as a secondary sphere mapping technique.
    Axis of alignment selector, you can now define which axis you want the cloud plane to align to.
    Clouds self-shadowing.
    Basic scene-view controls.

    Fix :
    Normals are now more accurate at high density as well as under grazing light.
    A lot of minor shader and editor code refactoring.
    Shadows casting onto the far plane.

    _____________________________


    As always it'll take a couple of days for unity's asset store team to review it before becoming available for download, if you really need this update as soon as possible send me a pm/email and I'll send it to you.


    Try this update once it is available and tell me if that was what you where looking for !

    I didn't forget about you guys, 'finally had time to implement your request, enjoy !
     
    NeatWolf and punk like this.
  28. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    I didn't expect that, thank you so much ! I will try it once it is available.
     
  29. nubdev

    nubdev

    Joined:
    Mar 30, 2013
    Posts:
    87
    Great asset. Is it possible to modify the Y position (not scale) of the clouds? I can't figure how to change it, feel like I am missing something incredibly easy.
     
  30. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hey, you can modify that on the material through cloud transform's x value ! The manual should be able to help you if you need further assistance, you can find it by pressing the help button at the top of the material.
     
  31. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Just a quick update, I somehow erased two characters in the shader file before uploading the update to the store which turned out to block shadow casting, a fix is being uploaded right now, sorry !
     
  32. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    It's quite good ! After some settings, i obtained a nice result. The only problem is that 's a bit expensive for performances. So, i'll put an option to deactivate it for littles configurations. However, do you have some advices to get performances more efficient as i try to get a not realistic effect, i mean something more cartoon, stylized. For now, i get something quite good setting the lods options.
     
  33. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Well, besides playing with variables under raymarcher, disabling spherical, you could render clouds to another lower res camera or use a lower res texture.
     
  34. reinabada

    reinabada

    Joined:
    Apr 13, 2017
    Posts:
    7
    Hi! I need help. I purchased the asset but I am kind of new in Unity, I am doing a simple VR demo. But I need a bit of more info in the tutorial. Can somebody explain for for Dummies like me how to actually place the clouds on the scene? This is what I did so far:

    Using Unity 2017.1
    - I added the Script RaymarchedClouds as a component to the VR Camera (using Steam VR Camera)
    - Then I drag and drop Volumetric Clouds LowQ in the materials of that script

    Now all I can see in the camera is pink. But when I click play the camera looks normal, the pink layer is gone but I don't know how to put the clouds.
    How can I place the clouds on the scene?

    Thank you for our patience.

    Maria
    Screen Shot 2017-09-23 at 6.00.16 PM.png
     
  35. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hey,
    Most of the time when something is pink like that it's because Unity stumbled upon an error when compiling the shader ; Unity couldn't understand the instructions to render the material either because of a programmer error, lack of support by your computer, the rendering API or unity itself. To solve that I need you to do the following for me :
    Right click on the Volumetric Cloud's folder and select Reimport, once he is done loading, take a look at the console and tell me if it printed out any errors or warnings.

    You control clouds through the material's interface, click on the material you added to the script and modify the values shown in the inspector.
     
  36. reinabada

    reinabada

    Joined:
    Apr 13, 2017
    Posts:
    7
    Thank you Eideren I Reimported it and now I can see it on the Game preview only if it's not on play, when I click play they disappear, also they don't show on the Vive. Thanks Screen Shot 2017-09-24 at 11.05.16 AM.png
     
  37. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    What does the console print out while in editor and in play mode ?
    You could try increasing "Plane Offset" on the script to something like 1.0 and see if that changes anything.
     
  38. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Eideren, Thank you for your updated resource, I have purchased it and am trying it out now.

    So far, I'm very impressed!
     
  39. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Hi,

    I got the clouds to work easily, and they look great!

    The one slight issue I am having is that the "Plane Alignment" is an explicit X,Y or Z selection. I need to be able to input an arbitrary rotation value (Vector3 or Quaternion) to match my players current rotation.

    Is this possible?

    I am currently looking through the code now, I will report back if I figure it out.
     
  40. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Hello,

    Is it possible to create the Perlin Normal Map texture of the clouds at runtime? If you tell me how you create your own texture, I could try to create them in runtime for my game.
     
  41. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hey,
    It's fairly simple really, the texture's alpha channel defines the clouds sizes and is generated by a perlin noise algorithm, the RGB channels are the normals and they are generated by running any sort of heightmap to normal map onto the generated perlin.
     
    Duende likes this.
  42. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Okay, thank you very much. :)

    I have another question, when a cloud gets into a mountain it goes through it, right? If there was a cave in that mountain, the cloud would cross that cave and it would look strange, because the cloud would appear through the walls. Is there any way to avoid that?
     
  43. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    You can create a density map to mask out your mountain, you can derive that based on an heightmap of your terrain for example, you'll have to inverse the min max value though since the shader expects the red channel's low values to mask out clouds.
     
    Duende likes this.
  44. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Well, at the end I bought your asset, I think I understood what you explained but if doubts arise I will ask you. :) However, it would be nice if you did a tutorial on how to create your own textures, that would help me and your other buyers to better understand how to create custom textures and collisions for mountains.

    Thank you very much for your attention and your work.
     
  45. djarcas

    djarcas

    Joined:
    Nov 15, 2012
    Posts:
    246
    upload_2018-2-4_22-41-13.png

    I'm curious what the 'Draw Distance' parameter does on the Screen Space Shadows? This is a grab with the shadows set to 128 (because they don't obey fog, I wanted to fade them out prior to that), but as you can see, the parameter is a bit... uh... confusing. Help? :)

    (The shadows are set to Bright Green so it's easier to make them out)
     
  46. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    It's supposed to cull shadow rendering past a certain distance, but in your case it seems to do the opposite ? Setting it to zero culls them completely, right ? And increasing it increases the distance before they are culled ? Could you try it out on a clean scene ? A bunch of unity cubes and a clean camera should be enough.
     
  47. djarcas

    djarcas

    Joined:
    Nov 15, 2012
    Posts:
    246
    I'll give that a go when I get a chance. It *feels* like it's clamping the ray length, as opposed to a screenspace depth clamp. (Altering the cull value in that image above causes the green-ness to go up and down vertically)
     
  48. Frank-1999-98K

    Frank-1999-98K

    Joined:
    Jun 30, 2015
    Posts:
    14
    Hi, I want to say that after a day of figureing out howthe Asset worked (or, for better saying, how it Reacted to my inputs) and another day of trying to play with textures,I got this (see the 2 long images below).
    It's versatile, quite easy to use and it doesn't afflict the GPU frames (still hits 900fps)!
    I think that with another time spent on it I could get some great use out of it!

    While playing with the Asset a couple of questions raised though...
    1) do you know why the editor laggs so much when I have the cloud material inspector open?
    2) when I go near a cloud and I am looking forward, clouds start disappearing like the draw distance get's lower and I can't figure out why:
    upload_2018-3-23_1-36-34.png upload_2018-3-23_1-46-3.png

    The cubes are 1mt big (the one in the sky is 1500mt high), the clouds are at 500mt and are 40mt high, the terrain is 10000mt squared, the draw distance is 100000mt, the shadow draw distance is 2700mt:
    Covered Sky:
    upload_2018-3-23_1-26-49.png
    Normal Sky
    upload_2018-3-23_1-37-37.png

    Regards
    --
    Diego Franchini
     
  49. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    Hey, thanks for passing by !
    Does it lag for the entire editor or only the scene preview ? If its the latter, it might just be because the scene preview doesn't have animated materials turned on, you can do so by clicking on the tiny picture button's arrow on the scene preview bar and toggle on the scene preview label in the dropdown.

    For the second issue, the raymarcher had to exit early on those pixels because it hit the maximum amount of steps, you'll have to play around with the values below the raymarcher header in the material to alleviate this problem.
    While increasing maxsteps will solve this issue alone, doing so will also increase the performance requirement to properly run this effect try fiddling with the other properties before that one, the manual (press the help button on the material) should be able to help you with those.
     
  50. Frank-1999-98K

    Frank-1999-98K

    Joined:
    Jun 30, 2015
    Posts:
    14
    Hey, thanks for the qwick reply!
    no, the scene view has the animated materials activated. The lagg occurs whenever I have the material selected and it gets even worse when I edit it's parameters. But as soon as I de-select it or select something else, the lagg stopps... :/

    Thank for the second one, I'll check it out!
    Could it be that the near surface stepps is the value that causes the early exit on pixels?