Cloud generator is under constant construction. My ultimate goal is to produce a 3-D, randomly generated sky with realistic clouds.
To start the learning process I have built a 2-D, 2-color model where clouds are created as combinations of randomly placed ellipses. Each cloud is made up of pixel-sized particles that have an (x,y) position on the canvas and move according to two forces. First, each cloud is generated with an inherent velocity, so each update sends pixel(x,y) to (x+x.velocity, y+y.velocity). Second, each pixel is affected by simulated wind in the x and y axis. Each point on the (x,y) grid is given a value based on Perlin noise. Here is a great explanation of Perlin Noise, but for intuition, Perlin noise is random numbers, but smooth. So when we plot a line of numbers generated by Perlin noise, the line has smooth curves whereas if we plot a line of regular random numbers, the line is jagged. The wind acts on each pixel in the same way that the velocity does. I also update the wind over time because the cloud movements are more realistic that way. This is easiest to see by checking the Show wind box.
I added the waves and surfers just for fun.
This is my second attempt, whose specific goals were realism and speed. In both I have clearly made strides. In this attempt, the data for each cloud is stored in two arrays, the array for the bottom values and the array for the top values. The bottom of each cloud is generated using perlin noise with a small variance and put into an array the length of the canvas. The top of the cloud, to give the puffy look of real cumulus clouds, is generated by taking an initial point, then finding the next point by moving up or down and left or right one pixel. How the point moves is based on where that point is on the canvas. Each point is placed into an array. Plotting these two arrays would simply show two lines. To add color, for every point in the top array, I fill the area between its y (height) value and the bottom array with a linear gradient between a few colors that I subjectively think look good.
This piece is not done yet, I plan to include a second canvas where the user can export the clouds they make by pressing the "Add Cloud" button to another canvas where they will be resized and then animated. I also want to improve the cloud shape in two ways: first, by changing probabilities of moving up/down and left/right, and second by changing the linear gradient so that the sun could be at different angles, allowing the clouds to cast variable shadows.
In the future, I plan to try using 3D Perlin noise where the first two dimensions are used to decide a density value for each pixel and drawing clouds based on that value than having clouds as objects. Then, the update feature will be the third dimension which will update over time and with each update, the clouds will be redrawn.
Finally, I plan to take these methods to the third dimension. The computational complexity increases a lot when doing that, and even the above program slows down with just a few extra clouds, so I may end up doing this as simulation in python or something similar and posting a video of the results here.