Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Giant Puffy Clouds

Discussion in 'General Graphics' started by Kellyrayj, Jul 6, 2018.

  1. Kellyrayj

    Kellyrayj

    Joined:
    Aug 29, 2011
    Posts:
    933
    I want to fly around some giant puffy marshmallow looking clouds. Where would you start? And what would you research to produce something like that. Particles? Shaders? Something I don't know anything about yet?

     
    Last edited: Jul 6, 2018
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,466
    It's a hard problem to solve, barely any body do it without trick. And it still takes renderfarm to have cloud looking this good without fakery.

    If you don't fly INSIDE the cloud, mobile cloud is a great asset.
    https://assetstore.unity.com/packages/tools/particles-effects/true-clouds-fog-mobile-pc-107379

    If it doesn't satisfy you try these other solution with various quality of rendering / tricks
    https://assetstore.unity.com/packages/3d/environments/landscapes/3d-cloud-models-4027

    https://assetstore.unity.com/packages/vfx/shaders/volumetric-clouds-25527

    https://assetstore.unity.com/packages/vfx/shaders/beyond-the-clouds-118044

    https://assetstore.unity.com/packages/vfx/particles/environment/3d-animated-clouds-17994

    Or look around with keywords for volumetric clouds shader
     
    Berserker44 likes this.
  3. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
  4. Kellyrayj

    Kellyrayj

    Joined:
    Aug 29, 2011
    Posts:
    933
    Very cool! Thanks for sharing friends!

    @jvo3dc You write that that's a 3D model? I'd love to see what the wireframe for something like that looks like!
     
  5. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,466
    any more details? You are simply using a SH lightmap? Does it support dynamic light? Does teh SH encode the distance through the cloud at each surface point?
     
  6. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Sure, here you go, could be a different cloud. It's made using a blobmesh over some random geometry.

    cloud_wire.png

    I think you should look a bit more into SH. It supports dynamic (directional) lighting as that is broken down into harmonics. Encoding any distance is not needed, since it's all baked.

    The outside of the cloud is simply unwrapped. I then apply a range of different lighting conditions according to the positive and negative components of the spherical harmonics. These a rendered (with SSS) to a set of textures. And they are then combined into 3 maps containing 9 channels for the greyscale lighting response to the first 9 spherical harmonics.
     
    Last edited: Jul 11, 2018
    richardkettlewell likes this.
  7. Kellyrayj

    Kellyrayj

    Joined:
    Aug 29, 2011
    Posts:
    933
  8. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,466
    I know about SH, I thought you were using a similar idea than the dice translucent shader, but instead of having directionless occlusion (should have use that word instead of distance lol) you had SH occlusion and therefore reconstruct the lighting in real time. Seems like you just have a sh lightmap that you query using a directional light, the color is baked.
     
  9. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Well, I convert the sky and the sun into spherical harmonics. Then I look up the amount of light that is transferred through the cloud for each spherical harmonic using the light maps. The cloud itself doesn't have any color this way, but the color of the sky and sun is transferred through the cloud. I do add a little blue to the cloud if the light intensity becomes lower. That looks a little more natural.

    It's fairly fast. Just three texture lookups on a single uv and then a couple multiplies and adds. I won't be able to light the cloud correctly from close by, but it's fairly accurate at calculating the lighting from far away (sky and sun.)
     
  10. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,466
    So it's thickness map not a lightmap? I'm confuse by how you explain it lol. Well technically it's the same concept, how much light can reach a pixel given a direction, thickness being the potential light, so we can use it to mask an analytical light as a way to represent implicitly the geometry. It's then like an extension of DICE's frorstbite transparency.

    - I mean when you bake there is no light? else you wouldn't be able to apply lighting after. But that make sense since a 3rd order SH has only 9 coefficients per channel, and you would need 27 to encode all colors.

    - The only remaining possibility is that light of day is sample through the direction in the SH, since light vary the same way everyday in a smooth enough rate to be enconded in SH. Hence Why I assume you had color in the map.

    But you had to wrote your own SH lightmap I guess? I didn't find any sodt that do it.

    I was thinking of emulating the effect using two pass, one backface, and then a substraction with the frontface to get the thickness. Not sure if worth it (need to happen in light space like shadow map?).
     
  11. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    It's not a thickness map. The maps encode the amount of light that can reach a pixel given that spherical harmonic coefficient. So all lighting is combined into 9 spherical harmonics (color values, so 27 floats in total). And then it's just something like:
    Code (csharp):
    1.  
    2. result = lightmap1.r * sh1.rgb;
    3. result += lightmap1.g * sh2.rgb;
    4. result += lightmap1.b * sh3.rgb;
    5. ...
    6. result += lightmap3.b * sh9.rgb;
    7.  
    Right, that's why I assume the cloud has no color and I just add a small color gradient based on the light intensity in the shader.
    Well, not really. I just have "sky domes" for each spherical harmonic. (Which is an animated sequence in max, so I can render all lighting passes as an animation.) All but the first spherical harmonic is split in a positive and negative part.
    I do also calculate the thickness like that, but that is mainly used for determining the transparency. (It's also used to accentuate silverlining from the sun, 3rd order spherical harmonics are not detailed enough for that.)
     
    Last edited: Jul 13, 2018
    neoshaman likes this.
  12. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,068
    Hey what's up Bridin?

    From personal experience, a 3d mesh model, is the way to go for making clouds.

    Using particles, is a is not a good option for creating clouds.
    Because that'll use up, a ton of resources and power and slow down
    your game, to a ridiculous amount. :p

    The tut below, is how I make simple and advanced 3d clouds.

    To make a cloud: :p

    In a 3d program, or 3d sculpting program.

    a) Create a basic, or crappy looking 3d mesh model, with a good number
    of vertices, or faces. eg. sphere or box mesh etc.

    b) Then select a sculpting brush, that can push and pull faces/vertices.
    This will help deform the basic 3d mesh model, and make it look like a cloud.

    c) After you have created something, that looks like a nice 3d cloud mesh,
    choose a shader/material of your choice, and apply it to the cloud model.

    d) Make a nice smooth blurry gradient texture for it, in gimp, or photoshop
    or krita etc. And then apply the texture, to the cloud model.

    Note: You can create 3d clouds, in a sculpting program, or 3d modelling software.
    Sculptris is a free 3D sculpting program. Check it out, whenever you have time.

    I was going to make a video tut, and then post it on youtube, or vimeo.
    But,......I have to buy a new PC soon. :p
    So I'll bookmark this topic, and whenever I make the tut, I'll post the link
    for it here, so everyone can see it. :)
     
    Last edited: Jul 13, 2018
    Westland and Kellyrayj like this.