Simple particle clouds (Work in progress)

DschoonmakerDschoonmaker Posts: 266Member
edited April 16 in Resources

I'm working on some clouds using particles, because particles are cheap but look good. Right the clouds are limited to a cube shape, and the noise is rendered in local space(I'm going to change it to world space so it looks more realistic).

Right now it looks pretty plain, I'll keep adding features until it looks nice.

Update
link to the github repository here: https://github.com/Dpschoonmaker/Godot-particle-clouds

«1

Comments

  • SIsilicon28SIsilicon28 Posts: 757Moderator
    edited April 2

    Very nice so far. Sometimes, the techniques of the past are still good in the present. :) Do you plan to have sun light affect the clouds (faked or not)?

  • DschoonmakerDschoonmaker Posts: 266Member

    Thanks, it's not much yet though. So far I don't have anything fancy for light(no refraction or similar), I just have a simple shader for each particle that has transmission. It looks too shadowed without it.

    The shader combines noise and a circular gradient texture for alpha, so that you don't see any edges. It just uses the default quadmesh uvs, but I think I'll modify the uvs in the shader (maybe render in world space) so that it looks more like one cloud and not a bunch of particles.

  • MegalomaniakMegalomaniak Posts: 2,884Admin

    One observation: if you haven't already, you might want to make your circular gradient have a non-linear falloff since clouds are a gaseous formation and experience pressure from the surrounding atmosphere. This is an oversimplified statement though, to be sure.

  • DschoonmakerDschoonmaker Posts: 266Member

    If the gradient is non-linear, should it be more gradual or closer to a solid circle?

  • SIsilicon28SIsilicon28 Posts: 757Moderator
    edited April 2

    I've worked with cloud rendering before, so I'd say bell shaped curve for a gradient.
    https://upload.wikimedia.org/wikipedia/commons/thumb/5/57/Smoothstep_and_Smootherstep.svg/220px-Smoothstep_and_Smootherstep.svg.png
    But the shape can be a little more complicated than that.

  • DschoonmakerDschoonmaker Posts: 266Member
    edited April 2

    Good idea, I'll try to do that. I think I'll have to generate the gradient in the shader, right now I'm just using a texture from an external program.

  • DschoonmakerDschoonmaker Posts: 266Member

    Okay, thanks for the smoothstep idea. I coded a smoothstep gradient inside the shader, now I don't need a texture for the gradient :). I changed some settings so the cloud shape looks a little more random, adjusted the transmission, changed the height, and various other tweaks to get this:


    Last but not least, I added an albedo parameter for different cloud colors:

    Oh and proximity fade:

    Unfortunately proximity fade doesn't work on the water shader.

    Next I'm going to add distance fade and some sort of trickery to simulate refraction/diffraction.

  • SIsilicon28SIsilicon28 Posts: 757Moderator

    I know I should've asked sooner, but when you say refraction, do you mean scattering? Refraction is normally associated with solid surfaces.

    Participating media can do four things with light.

    • In-scattering
    • Out-scattering
    • Absorption
    • Emission
  • DschoonmakerDschoonmaker Posts: 266Member

    I don't really know many terms for it, refraction is probably the wrong one. I just mean the bouncing around of light inside clouds, it's talked about in this video That's a complicated and expensive way to do it, I'm going to do some fake and cheap method. I'm not entirely sure what yet.

  • SIsilicon28SIsilicon28 Posts: 757Moderator
    edited April 3

    Yeah I've actually watched video before. It was very insightful. It would've been great if I watched while I was making my cloud tracer.

    @Dschoonmaker said:
    I don't really know many terms for it, refraction is probably the wrong one. I just mean the bouncing around of light inside clouds,

    So you do mean scattering. Alright understood. :)

  • DschoonmakerDschoonmaker Posts: 266Member
    edited April 3

    Your volume renderer would be great for higher quality clouds(I want something cheap, Godot isn't a powerful engine and I have two cameras rendering simultaneously).

    Scattering, that's what it's called. I'll search for that instead.

  • SIsilicon28SIsilicon28 Posts: 757Moderator

    I know my renderer is meant for higher quality computers. Your clouds would definitely be well suited for low end devices.

  • DschoonmakerDschoonmaker Posts: 266Member

    Your renderer is really awesome, but I saw you got about 10 FPS on Intel 4400.

  • SIsilicon28SIsilicon28 Posts: 757Moderator
    edited April 3

    Depends on the settings. I get about 12 fps with 16x tile size, 64 samples, but it's only because an integrated graphics processor. They're notorious for being low-end graphics hardware.

  • DschoonmakerDschoonmaker Posts: 266Member

    Yeah, I'm thinking of replacing mine.

  • DschoonmakerDschoonmaker Posts: 266Member

    I added a shader for the particles process material, I think I'm done with the graphics, unless I can think of a way to fake shadows(because the clouds are way beyond the maximum shadow casting distance). I'll make a system for cloud movement/lots of clouds, maybe even a weather system next.

  • SIsilicon28SIsilicon28 Posts: 757Moderator
    edited April 4

    You know I just realized something. Doesn't the Godot shading language come with a builtin smoothstep function?

  • TwistedTwiglegTwistedTwigleg Posts: 3,076Admin
    edited April 4

    It looks like you can use smoothstep with floats or with vectors: Shading-Language built-in functions.

    Out of curiosity, and this is slightly off-topic, but what is there a difference between smoothstep and mix?

    Edit: Nevermind, I found this site (paulbourke.net) showing the different interpolation functions mapped. It looks like it a smoother version of interpolation, similar to cubic interpolation visually.

  • SIsilicon28SIsilicon28 Posts: 757Moderator
    edited April 4

    Well the difference between smoothstep and cubic is that cubic interpolation (1D for example) would take 4 sample points, while smoothstep still takes 2.

  • DschoonmakerDschoonmaker Posts: 266Member

    I don't know how smoothstep works, but that's the function I used to generate the texture.

  • SIsilicon28SIsilicon28 Posts: 757Moderator

    Hiya! How are the clouds going? Hope progress has been made. :)

  • DschoonmakerDschoonmaker Posts: 266Member

    Not much progress at all, I've been quite distracted by some other shaders I'm working on :p
    Maybe I'll do some work on the clouds tonight.

    Off topic, but about your volumetrics plugin:

    @SIsilicon28 said:
    Instead of finishing the demo (which I did), I created a 3D texture generator. Now it's easier to texture fog!

    Does this mean you can use any mesh you choose?

  • SIsilicon28SIsilicon28 Posts: 757Moderator

    Nope. It just means you can add a texture to the volumes; a noise texture to be more specific. I made a mesh to volume generator years ago for my other volume plugin; maybe that can be used here, but I don't wanna bother integrating that for now.

  • DschoonmakerDschoonmaker Posts: 266Member
    edited April 8

    Oh, okay.

    Update:

    This is 64 clouds, each with 64 particles, and each of the 64 clouds is updated each frame. Unfortunately, the clouds usually end up bunched up, so I might have to add a minimum distance each cloud can be from another.

    And it looks worse than in the other images simply because the particle scale is too small, it looks a little too much like dots. I was just too lazy to change it; right now I have to duplicate the particle system for each cloud. I'll make that automatic later.

  • SIsilicon28SIsilicon28 Posts: 757Moderator

    Yeah, and the clouds look pretty bright too.

  • DschoonmakerDschoonmaker Posts: 266Member

    From that angle, they do, but that can be changed if I adjust the color and transmission. I'll do that and see if I can get it to look a little better.

  • DschoonmakerDschoonmaker Posts: 266Member

    I added some export variables to the parent node, now I can change those and every cloud will change with it. Plus I don't have to go into the materials, the properties are all in one place.

  • SIsilicon28SIsilicon28 Posts: 757Moderator

    Hey hey hey! How's the progress today?

  • DschoonmakerDschoonmaker Posts: 266Member
    edited April 15

    It's going alright, except when I use randf() to move the clouds, they all seem to move in the same direction.
    This shouldn't be, I have a loop iterating over every cloud to move it, and it calls randf() separately for every cloud....

    I have successfully limited the clouds to a certain area, which can be defined with an export variable. This will be used for different environments, e.g. jungle v.s. desert, to change properties such as cloud density/color.

  • SIsilicon28SIsilicon28 Posts: 757Moderator

    It's going alright, except when I use randf() to move the clouds, they all seem to move in the same direction.

    Shouldn't they be moving in the same direction? You know, with wind and all.

Sign In or Register to comment.