• Resources
  • Simple particle clouds (Work in progress)

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

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)?

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.

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.

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

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.

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.

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

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.

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. :)

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.

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

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

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.

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.

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

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.

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

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

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

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?

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.

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.

Yeah, and the clouds look pretty bright too.

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.

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.

7 days later

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.

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.

They should be moving in roughly the same direction, but right now they're all arranged in a line. I think I'll switch to generating a random point inside the area, then adding parameters for wind direction and strength to add some more uniform movement. edit: I might be done with this project by now, but I got distracted by water and terrain shaders.

Well, different layers at different elevation might move in different direction, but yeah the same layer I'd expect to move in the same direction, unless we consider something like turbulence, but then I'd think of that as a systems internal dynamic and as a whole it would still be moving in one direction.

Hmm, maybe I could have a texture to simulate wind direction? But there's no texture() function outside of shaders.

I don't think that kind of control would be necessary... Most games just simplify cloud movement to at most 1 or 2 constant wind directions.

Also, have you considered sharing the code via GitHub? There might be people out there that could help contribute to it. ;)

Yeah, I hadn't thought about that. I'll look into getting GitHub account(tomorrow).

Oh? Glad you figured out how to upload some of the files, but maybe it'd be better if you uploaded the whole project, so that it's easier to edit.

Good idea, I'll make a new project and import them in.