Search Unity

Volumetric Clouds

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

  1. Dandolittle

    Dandolittle

    Joined:
    Jul 2, 2013
    Posts:
    17
    So put it in the editor folder but i never had a VCloudShaderGUI inside it.
    i did however have a NPRShaderGUI which when removed and replaced with the one you gave me cleared everything up.
    Could have been when importing it just never deleted the script in my folder.

    Cheers for the help! greatly appreciated
     
  2. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    NPR was the one provided in an outdated version, unity's importer is supposed to take care of those kinds of things, you should probably delete the version you have currently and re-import the latest one just to be sure !
     
  3. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    392


    @Eideren I'm really digging the new clouds, super fast and much better looking than version 1, here's a pic from the game, at some point I want to implement procedural lightening effects, do you know if they could be lit up in a certain area, or would I have use some trickery to fake it?
     
  4. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    I'll add point light support in the next update. Shader arrays aren't set up in the same way in 5.4 so I might wait until it comes out of beta.
     
  5. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    392
    Fantasic, I'm in no rush, great work btw ;)
     
  6. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Thanks for the link. sorry but i`m gonna disagree with you. i understand the idea and principals of ray marching very well. i have trawled every resource the internet can supply. I`m simply asking for a bit of help to get that code suppled to be more useful to anybody. if shader forge cant do it then why even post the tutorial on the shader forge wiki. i`m very good at what i do (Game developer artist), and well versed in shader forge, but i`m not a shader programmer and the main reason for buying the package was the shaderforge nodes. now its largely usless to me and was hoping for a little support.
     
  7. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Shader Forge is not and has never been advertised as any kind of node-based ray marching shader builder. You can build many kinds of shaders but they're geometry based, something ray marching is not. You should ask Eideren for the old version of Volumetric Clouds if you want something that has more of a "pure" Shader Forge setup.
     
  8. sashahush

    sashahush

    Joined:
    Sep 5, 2012
    Posts:
    75
    Hi there! Amazing update! I have a question is there a way to detect if the camera is inside a cloud?
    I would like to add detail particle effects in front of the camera when the camera enters a cloud.
     
  9. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    That raymarching tutorial is free, it wasn't advertised with the package and wasn't included with it either, this is what I said:
    It's completely fine to complain about this tutorial but you can't involve this asset's support into the mix if it isn't even part of it.
    If you bought it before 2.0 and the lack of nodes is the real problem here then you can always use 1.5, if you don't have it anymore I'll send it to you !
    On top of that, this asset is 10 dollars, that's really not a whole lot of money for the work I put out, be it for the actual creation of it or the support (for almost a year and a half now), I didn't even charge you more for an update nor did I increase the base price for 2.0 when really, it's not even the same asset at this point.

    I posted it on the wiki since it is still made using that plugin, as far as I know this wiki isn't limited to only code node free shaders/tutorials.

    I can assist you if you need any help learning shader programming but I can't, with the tools that Shader Forge provides, create an overall more useful shader, everyone has different ideas of what they want to create with a raymarcher and creating a generic one is not possible simply because for that we would need parameters and node trees running inside the for loop to create anything raymarched, as long as we don't have access to a loop node it simply isn't possible.

    Attached to this post there should be a shader which is based on
    And as you can see, it's just adding more code inside the loop.
     

    Attached Files:

    Last edited: May 19, 2016
  10. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hi, checkout the archive attached, it's a script which plays events when a transform comes inside and out of clouds.
    • "Cloud Material" is the material you are using on your camera.
    • "Event Threshold" is the amount of opacity required before playing an event.
    • "Events" is your collection of event, inside it each event has :
      • "Name" it's name, doesn't really matter, changes this event's name in the inspector.
      • "Monitored Transform" the object that the script should check when figuring out if it is inside clouds.
      • "Is Inside" is useful for debugging, tells you if the object is inside clouds.
      • "On Enter ()" an event which plays when the object enters clouds, see unity's tutorial at around 3m50s
      • "On Exit ()" same as above but when it exits clouds.
    • "Show Debug Cubes" shows a bunch of cubes around the event manager which shows the script's point of view of the clouds.
    • "Debug Cube Count" amount of cubes per row to show.
    • "Debug Cube Size" size of those cubes.
    • "Show Event Trigger" cubes will turn black if they are considered outside clouds and white if they are inside, useful to figure out a correct value for "Event Threshold".
    Have fun !
     

    Attached Files:

    sashahush likes this.
  11. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    :\
     
  12. LordMortis

    LordMortis

    Joined:
    Jan 25, 2014
    Posts:
    23
    Any idea what could be causing this:


    That's rendered via a HTC Vive headset, the script has been applied to the "eye" camera. One thing i had to do to get it working at all was to modify the width of the plane the shader is rendered onto - it wasn't wide enough, so I modified line 130 in VolumetricRaymarchedClouds.cs to the following:

    float frustumWidth = frustumHeight * thisCam.aspect * 2.0f;
     
  13. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hi,
    I don't have access to an HMD so I can't exactly reproduce this issue but with the SteamVR(version 1.1.0 with unity 5.3.4f) plugin on the asset store it didn't happen.
    What version of Unity and plugin are you using ?
     
  14. LordMortis

    LordMortis

    Joined:
    Jan 25, 2014
    Posts:
    23
    Unity 5.4.0b19 and SteamVR 1.1.0
     
  15. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    You have an outdated beta version, I'll look into b20 and see if I can reproduce it.
     
  16. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Scratch that, I can't because that version requires me to have an HMD plugged in ...
    Well, I don't think it comes from my stuff, it seems to only skew the sampling position / direction, culling and lighting stays accurate. What happens if you put another material on the script attached to your camera, could you try with a texture ?
     
  17. LordMortis

    LordMortis

    Joined:
    Jan 25, 2014
    Posts:
    23
    if i replace the material with a material based on a default unity unlit texture and put a texture in the texture slot, i get (what appears to be?) that texture rendered to the output. (it doesn't shift at all when i move the headset)

    Is there any other logging info i can give you?
     
  18. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Well it probably comes from Unity, this thread talks about an issue which is similar to ours (raymarching uses viewdir to sample clouds) so we might have to wait for a proper release of 5.4.
     
  19. LordMortis

    LordMortis

    Joined:
    Jan 25, 2014
    Posts:
    23
    Aha! Okay, I'l take a look at the new version of Unity 5.4 and hopefully that will fix it (I think I saw that in the patch notes somewhere)
     
  20. Dandolittle

    Dandolittle

    Joined:
    Jul 2, 2013
    Posts:
    17
    Hey Eideren,
    So using water and terrain together in my scene. I have had to up the render queue as the clouds will appear under water. but what i discovered was the shadows are linked with the same render queue.
    Is it possible to separate them with 2 render queue options (one for clouds and one for shadows)?
    i had a look myself but couldn't pin point where the shadows are being made.
     
  21. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Those shadows don't really work in the same way as your standard shadowmap does, clouds and shadows are rendered in a single pass and only for pixels on your screen, doing it in a single pass means that the GPU can easily avoid computing shadows for pixels where clouds are already fully opaque, and can use already computed data from the same pass that the rest of the raymarcher used like the pixel's position in 3D space to figure out if it should be shaded or discarded.

    Sorry if you already knew all of that but I had to clarify it before continuing.

    I'll look into it but, as you could figure out from what I said above, that doesn't come free, It won't be twice as slow but don't expect any miracle.
     
  22. pgeorges-dpt

    pgeorges-dpt

    Joined:
    Apr 7, 2016
    Posts:
    43
    Hey there,

    I love your clouds! The only problem we're having is with Unity Cloud build when building standalone Mac. Here are the errors that we're getting which is stopping us from exporting the player.

    407: [Unity] Shader error in 'VolumetricCloud': '_MaxSteps' : variables with qualifier 'const' must be initialized at Assets/VolumetricClouds2/Scripts/UnityStandardCore.cginc(456) (on opengl)
    408: [Unity] Shader error in 'VolumetricCloud': '_MaxSteps' : variables with qualifier 'const' must be initialized at Assets/VolumetricClouds2/Scripts/UnityStandardCore.cginc(456) (on metal)
    409: [Unity] Shader error in 'VolumetricCloud': '[' : syntax error syntax error at Assets/VolumetricClouds2/Scripts/UnityStandardCore.cginc(766) (on opengl)
    410: [Unity] Shader error in 'VolumetricCloud': '[' : syntax error syntax error at Assets/VolumetricClouds2/Scripts/UnityStandardCore.cginc(766) (on metal)

    Can this possibly be fixed soon as it totally breaks our build machine.

    Thank you!

    Paul
     
  23. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hi, you should have received a PM containing a fix, check your inbox !
     
  24. mlsptn

    mlsptn

    Joined:
    Jul 27, 2016
    Posts:
    7
    Hi,

    This is an excellent asset that I am looking forward to using in my project.

    Right now, however, I am having a problem using a realtime reflection probe with the asset, and I'd really appreciate some help.

    I'm using VolumetricClouds2 with Unity 5.4, and am trying to get the clouds to reflect changes I make to my procedural skybox material during play mode. I have a reflection probe in the scene which bounds the camera that the raymarched clouds script is attached to. Changes I make to the skybox material during play mode – e.g. changing atmosphere thickness – don't seem to effect the color of the clouds. When I change the skybox material during edit mode, the color of the clouds changes after a second, due to baked maps being updated I imagine.

    Other objects in the scene that are bounded by the reflection probe correctly respond to skybox changes during play mode.

    Do you know what I can do to get the reflection probe working with your clouds?

    Thanks!
     
  25. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hi, so from what I understand the GI shown on clouds aren't accurate to your procedural skybox if changed and in play mode right ?
    In that case you just have to add a light probe group in your scene, clouds have a very uniform reflectance models so they shouldn't be affected by reflections/reflection probes that much if at all.
    Have fun !
     
  26. mlsptn

    mlsptn

    Joined:
    Jul 27, 2016
    Posts:
    7
    That worked, thanks a lot!
     
  27. BearShark1993

    BearShark1993

    Joined:
    Oct 22, 2013
    Posts:
    5
    Hi this a fantastic asset btw. I am wondering if others have run into this shader error after updating to Unity 5.4.0f3

    Shader error in 'VolumetricCloud': 'ShadeSHPerPixel': no matching 3 parameter function at UnityGlobalIllumination.cginc(126) (on d3d11).

    EDIT: NVM my bad I just noticed the 5.4 txt file in the instructions solved it
     
    Last edited: Jul 29, 2016
  28. VFCorsairw

    VFCorsairw

    Joined:
    Aug 2, 2016
    Posts:
    1
    This is a wonderful asset, however I need to get the clouds to render on the XY plane as opposed to the XZ plane. I had hoped there were some vector3s that I could reconstruct, but I can't seem to figure it out.
     
  29. ryan_lay

    ryan_lay

    Joined:
    Aug 2, 2016
    Posts:
    4
    Loving the look of the clouds. Is there anyway to have these render spherically or track with the cameras position and orientation? I'm building a spherical planet and the camera tracking would make this a much better cloud implementation than i currently have.
     
  30. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Use a camera to capture the cloud how you want them to be and change their order and clear flags to correct render before your main, I should't use multiple shader compile path for each plane orientation since they are already so limited so that's the only way to deal with it for now.


    I read your PM and no, there's no way to properly rotate them but you could still translate the camera that captures them, your capture camera's rotation y axis always point towards Vector3.up and it's forward axis points towards the forward of your main camera local to the planet's surface, capture camera's position on the y axis is the distance between your main camera's position and the planet's center.

    I'm still figuring out a way to map them on a sphere, we'll see.
     
  31. ryan_lay

    ryan_lay

    Joined:
    Aug 2, 2016
    Posts:
    4
    Thanks for the reply and the info, I'll have a look and see if I can get it working how i want. I'll certainly be keeping track to see if sphere mapping comes about, would be perfect for me at that point.
     
  32. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,968
    Hey there,

    Using Unity 5.4.0f3 it seems like the clouds disappear at certain angles. It doesn't do it in the Scene view, only the Game view. Any idea what could be causing it? I'm using the replacement shaders.

    Sorry for the huge gif!



    <<<EDIT>>>
    Okay I found that this was caused by the Occlusion Culling, but I'm not sure why. Any insight?
     
    Last edited: Aug 10, 2016
  33. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hi,
    Are you talking about the dynamic or the static/baked occlusion culling ? The plane used to render clouds isn't marked as static so baked shouldn't really affect it. As for dynamic, the plane might be too close from the camera's near plane, I sent you a file in PM, could you try that out ?
     
  34. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    55
    I'm getting the same issue. Can I also try the fix? Also, shadows are at different offsets in the HTC Vive. Any clues on how I can get the shadows to behave in VR?

    Lastly, great work. This cloud system is amazing.
     
  35. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    You should have received it by now

    I'll try to upload that fix asap on the asset store.
     
  36. Generalkidd

    Generalkidd

    Joined:
    Nov 24, 2014
    Posts:
    9
    Not sure if this has been brought up before, but after importing the assets and following the instructions on the PDF, the Volumetric cloud materials are just pink colored and when attached to the camera, everything is just pink on the screen. The scripts compile fine with the exception of one "Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported in Unity 5" error.
     
  37. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    That error doesn't come from my asset, the only mesh collider being created is coming from the CreatePrimitive method used to create the render plane but it is deleted right after that method call and it cannot create that primitive without deleting it's mesh collider, on top of that, that error is neither a compiling error nor a straight up shader error so it shouldn't turn pink because of that.

    Did you read the file named 'README Unity 5.4+.txt', if you are using unity 5.4 and above that's probably the reason it doesn't compile.
     
  38. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hello everyone !
    So the fix I talked about on the 16 of august is delayed but for good reasons, I finally came up with a solution to curve the clouds, it can now be rendered as an entire sphere and it's actually working properly so if you guys are doing any space sims' or if your world is spherical you can use this system to render clouds around it, I also implemented point light rendering since unity supports shader arrays now.
    I'll be done in about two days and upload it right after, I'll tell you once that's done.
     
    punk and Wavinator like this.
  39. ElectroMantis

    ElectroMantis

    Joined:
    Sep 15, 2013
    Posts:
    78
    That sounds cool, just bought the asset yesterday, and am excited to use it. Will semi spheres be supported as well?
     
  40. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Probably not since that would add to the complexity of my intersection test, is there a specific reason why you would use an hemisphere over a sphere ?
     
  41. ElectroMantis

    ElectroMantis

    Joined:
    Sep 15, 2013
    Posts:
    78
    My scene takes place on some floating islands in the sky, so I thought it would look nice if the clouds wrapped around the bottom of the scene. If it adds too much complexity, then it doesn't really matter, I'm actually satisfied with the way it works now.

    Will it ever be possible to "Posterize" the shading on the clouds to give a sharper toon style look? At the moment I've just turned normals off, because I'm struggling to get a crisp look without getting that swirly pattern (or tanking the framerate).
     
  42. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Well it does, I mean it's a sphere so it'll wrap both below and above as well as on every sides, oh, you mean just render on the bottom ? Just to clarify, I'll implement it if there is a proper use case for it, I just can't spend GPU cycles, compile time and dev time on a feature which won't have a proper implementation or which isn't that important !

    As for the cartoon look, there's two textures which uses less micro details and you can still modify the base ones as well as create new ones, you'll have far more control over your shading if you modifiy the normals themselves, to posterize them you can just use a similar image filter in your image editing software.
    To get a proper useful posterize/cel shading effect you probably want something like a ramp texture to define the shading which in this case is pretty much the same thing as modifying the normal map itself.
     
    ElectroMantis likes this.
  43. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hello everyone, here's the changelog for this update :
    Added/Modified :
    • Support for spherical mapping, perfect for atmosphere and planet rendering.
    • Support for point lights for unity 5.4 and above.
    • Supports unity 5.0 and above properly.
    • Rendering shadows only is now possible.
    • Rewrote access to Unity's GI, should need no to minimal support for upcoming unity releases.
    • Created a new script called "CloudsEvent", fires user defined events when entering and exiting clouds.
    • Changed material display to Plane instead of sphere.
    • Added multiple fields to give more controls over clouds :
      • "Normals Intensity" under normal map.
      • Spherical mapping controls : position and stretch horizon.
      • Orthographic Perspective, fakes perspective when rendering in orthographic.
      • Render plane offset from camera's clipping plane.
    I'm uploading it to the Asset Store right now, it'll take some time for them to review it and then it'll show up on the store.
    I fixed a bunch of stuff since the last update but I didn't write it down, so yeah, try this update once it comes out and tell me how it fared !

    P.S.: Before updating delete both subfolders "Scripts" and "Editor", I removed a bunch of files and Unity's asset updater doesn't always get that.
     
  44. rafa207

    rafa207

    Joined:
    Apr 3, 2014
    Posts:
    1
    Hi Eideren,

    I'm developing for Oculus DK2 and I`m having a issue. The clouds just cut in the middle.
    I put your script in the CenterEyeAnchor inside the OVRcameraRig.
    It works fine when i unplug the Oculus.

    Ty for any help.
     

    Attached Files:

  45. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hey !
    VR cameras don't actually report the actual frustum used when targeting both eyes so I can't place the render plane exactly on each eye, so you probably have to split your camera's rendering from both eyes to two cameras with each eye ? I don't know enough about VR/own a VR device to help you further than that...
     
  46. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    392
    Looking forward to it :)
     
  47. ryan_lay

    ryan_lay

    Joined:
    Aug 2, 2016
    Posts:
    4

    Awesome additions! Haven't implemented yet for my planet, will post on here if everything is working well!

    Update:

    Implemented it in the project and they map well, looks very nice. Issue is that even when I set up a blank scene and use the LowQ version, when I set to spherical I'm getting a max of 70 fps compared to the 160 fps of using it as a flat plane. Is this to be expected or is it a bug? having it drop to 70 when that's the only thing in the scene will make it impossible to use in my game. My GPU is a GTX 770 by the way so should be running this fine.

    If this is to be expected, do you have a recommended setting for max performance whilst still getting usable clouds? Will test it out.
     
    Last edited: Sep 3, 2016
  48. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    392
    @Eideren those new point lights are looking awesome - thanks for doing that ;)
     
  49. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    303
    Hi,
    So an empty scene is one of the worst case scenario for this system because it won't be able to skip tons of computations based on objects occluding clouds.
    Example :
    Standard case :
    Your PoV is from the surface of a planet looking towards the horizon the system can already skip 1/3->1/2 just because the ground is occluding clouds wrapping around.
    Really bad case :
    Your PoV is from outside the sphere, near its surface, looking straight towards its center and nothing is occluding clouds, your entire screen is filled with semi-transparent clouds.
    This case is particularly bad since if the current pixel isn't entirely opaque once it rendered the surface closest to you it has to continue searching clouds towards the surface of the sphere opposite to you. Also, if you trace a ray from each pixels position towards infinity, each one of them intersects with the sphere and so cannot be entirely skipped either.

    I still have to implement a way to push the ray to the closest bounds once inside the sphere but that will be useful only if nothing is inside the sphere and if you are looking from the outside of it which probably is less than 5% of the cases in-game and which also reduces overall performances since that would need another conditional, GPUs don't like those at all.

    I could also render the all thing in a lower resolution but that would need me to rewrite a lot of the pipeline if I want to properly use scene occlusion and avoid aliasing around those from showing all over the place ...


    Just to be sure, if you put an empty plane between the sphere and your camera and cover your entire field of view with it, your fps goes through the roof, right ?

    Also, did you read the "Raymarcher" part in the manual, that should help you properly optimize for your target hardware.
     
  50. ryan_lay

    ryan_lay

    Joined:
    Aug 2, 2016
    Posts:
    4
    Thanks for the reply, I'll take a look through later today to try out some of your suggestions and will let you know how it turns out
     
unityunity