Home Unity

Volumetric clouds, worth it?

polycounter lvl 9
Offline / Send Message
CarlCraft polycounter lvl 9
I have been researching volumetric clouds this past week, and am wondering if anyone else has any experience working with it. I have found some open source examples/demos, but can't really wrap my head around it. As I see it ray marching is the way to go, but how that works is currently magic to me :dizzy:

Is volumetric clouds even feasible in a game? In my case, they would have to be easy to place out for a level designer, not be too costly on performance and look good and thick when flying through them. Anyone got any experience or ideas?

Thanks

Replies

  • Humming
    Offline / Send Message
    Humming null
    Yeah, I've been wondering just that. It really depends on how you configurate your shadows...
    Yesterday I've worked on a scene to study lighting, ambience and post processing and it turned out pretty good:
    https://www.youtube.com/watch?v=3FVhfHvw9Ro


    Don't mind the low FPS, I don't have a high-end PC and I had to record this in HD to get the sawdust particles on the record.
    The scene used only 1 light source, as I didn't saw a reason to use other lights.
    In more complex scenes, you can always use a good light probe (wich I didn't used in my scene) and most of the FPS related problems will go away.
    More info. about the stuffs I've used can be found in the video's description.
  • Eric Chadwick
    Watch Dogs 2. They've implemented this for dynamic fog, looks pretty amazing. Not sure about how well this would work in Unity.


  • Eric Chadwick
  • CarlCraft
    Offline / Send Message
    CarlCraft polycounter lvl 9
    @Humming Nice one, but I'm not looking for volumetric ambience, more of actual clouds. Quicke example from upcoming game Sky: 

    Something you could fly through and feel its density basically.

    @Eric Chadwick That looks dope, but you can't really know if it's just trickery or actually done volumetrically(?). I have done some research these past days and I'm pretty sure doing it properly volumetric requires too much performance and is not really easy to edit (say you want a cloud in x size at y position...).

    I'm currently looking at ways to fake it, looking at how they did it in The Witness. But damn, it's hard :D Anyone have any clue on how to modify normal directions of a mesh based on another gameobject? trying to fake this technique:

    Currently I have a fragment shader, and I figured out you can access the normals through
    o.nDir = UnityObjectToWorldNormal(v.normal);
    But that's pretty much as far as I've come. I've tried multiplying its x, y and z values but that's not correct. Need the normals to be pointing in the "same direction", away from its center basically. Or should I perhaps make a new c# script that takes care of the normals, instead of doing it in the shader?
  • radiancef0rge
    Offline / Send Message
    radiancef0rge ngon master
    you can use transfer attributes in maya. not sure how to do this in max

  • Eric Chadwick
    Watch Dogs 2 is a true raymarching volume solution. You can go into and around the fog, and it's dynamically lit.
  • jStins
    Offline / Send Message
    jStins interpolator
    Have you seen this? I haven't had a chance to experiment with it, but looks like it could be worth a look for something like this...

    https://www.youtube.com/watch?v=PCrc2cWDX1E
  • CarlCraft
    Offline / Send Message
    CarlCraft polycounter lvl 9
    you can use transfer attributes in maya. not sure how to do this in max

    I am aware, I pride myself in once being in the polycount wiki for the transfer attributes in Maya for this technique :smiley: Right now I'm trying to do it inside of Unity though. I know you could just do it in maya/max and import it, but I want to be able to do it in Unity for quick and easy iteration and also perhaps make it dynamic.

    Watch Dogs 2 is a true raymarching volume solution. You can go into and around the fog, and it's dynamically lit.
    That's amazing. I spent pretty much the entire week researching raymarching and came back empty handed. It's just me taking water over my head at the moment, which is why I'm trying to "cheat" to be able to get some result and have a starting point.

    jStins said:
    Have you seen this? I haven't had a chance to experiment with it, but looks like it could be worth a look for something like this...

    Yes I have kept my eye on it, and will definitely check it out. It will probably be great to use. Right now I'm hoping to soak in as much knowledge and experience as I can, and trying not to rely entirely on others solution. With that said, I most definitely learn from looking at others solutions :)

    Currently I'm able to change the normal directions. I have an empty gameobject and I transfer its position into the shader of the cloud, but from there I'm not sure where to go. I want the clouds normals to point outward from the gameobject (which is in the middle of the cloud). I figured some sort of raycast would solve that, so I did:
    half3 direction = _CloudCenter.xyz - o.nDir;

    And then lerped and normalized the direction with the clouds normals (which I was told to do in the Unity forums...)
    o.nDir = 1- normalize( lerp(o.nDir, direction, lerpAmount) )

    If someone knows how to do it you will see I took a few too many right turns when I should've taken a left  :# Things that I am confused/stuck/wrong about:
    •    It's one minused because all faces face the wrong way. I probably shouldn't have to do that
    •    I have no idea how much I should lerp with, or why
    •    I'm still changing all of the normals in a clump (o.nDir), not per normal vertex. Maybe that is OK, though
    •    Not sure that the raycast is the way to calculate the outward-pointing-from-center to change the normals
    Also, right now the mesh is invisible from certain angle, like so:
    https://gfycat.com/BrokenSpeedyAlabamamapturtle
    You may also note that all normals point in the same direction, so I know that the above calculation is wrong for real. Doesn't matter where I place the center point to calculate from, it always looks the same.

    EDIT: I just added a camera to the scene. Now the invisible parts of the cloud is instead black:

  • Goldenvale
    Offline / Send Message
    Goldenvale polycounter lvl 5
    CarlCraft said:
    @Humming Nice one, but I'm not looking for volumetric ambience, more of actual clouds. Quicke example from upcoming game Sky: 

    Something you could fly through and feel its density basically.

    @Eric Chadwick That looks dope, but you can't really know if it's just trickery or actually done volumetrically(?). I have done some research these past days and I'm pretty sure doing it properly volumetric requires too much performance and is not really easy to edit (say you want a cloud in x size at y position...).

    I'm currently looking at ways to fake it, looking at how they did it in The Witness. But damn, it's hard :D Anyone have any clue on how to modify normal directions of a mesh based on another gameobject? trying to fake this technique:

    Currently I have a fragment shader, and I figured out you can access the normals through
    o.nDir = UnityObjectToWorldNormal(v.normal);
    But that's pretty much as far as I've come. I've tried multiplying its x, y and z values but that's not correct. Need the normals to be pointing in the "same direction", away from its center basically. Or should I perhaps make a new c# script that takes care of the normals, instead of doing it in the shader?
    You can use Slide Normal Thief. Very easy to use: http://www.scriptspot.com/3ds-max/scripts/noors-normal-thief
  • CarlCraft
    Offline / Send Message
    CarlCraft polycounter lvl 9
    @Goldenvale
    I was looking for a way to "fake" modified normals inside of Unity. I have since abandon that ship and did it the way The Witness did it with multiple passes (Alpha cutout for sorting + Alpha fade for smooth edges), but instead of having multiple chunks of planes making the cloud I instead use a single mesh with triplanar displacement map to give it the cloud shape. 
  • MarcoAntonio
    Offline / Send Message
    MarcoAntonio polycounter lvl 6
    Hello CartCraft! Well, Volumetric clouds worth it but they are difficult to made. The basics are easy to implement but designing the clouds density is not easy and how you code them will impact on the framerate a lot. I myself am working on a volumetric clouds system. Here you have a old video from my system:
    https://www.youtube.com/watch?v=3oQVWmhgGmk&t=10s

    And here you have a screenshot from my system as it is right now:

  • CarlCraft
    Offline / Send Message
    CarlCraft polycounter lvl 9
    MarcoAntonio Hmmm, that's pretty interesting... How do you "place" the clouds in your case? For me it's important to be able to have clouds in certain positions, which is also I've noticed may not be so easy with volumetric clouds
  • MarcoAntonio
    Offline / Send Message
    MarcoAntonio polycounter lvl 6
    CarlCraft said:
    MarcoAntonio Hmmm, that's pretty interesting... How do you "place" the clouds in your case? For me it's important to be able to have clouds in certain positions, which is also I've noticed may not be so easy with volumetric clouds
    Well, my system is a postprocess image effect and it uses a position buffer to set the clouds in scene. To create my scalar field of density I just use an external picture I did inside photoshop using clouds perlin noise. You can extend this using 3d perlin noise textures to erode the clouds. In my case, I still could not implement this but I am planning to do it.

    In any case, the best way may be using houdini to create a 3d texture. And use it to create you scalar field. Is the same thing the guys from Guerrilla did in Horizon. 
Sign In or Register to comment.