The last few weeks have involved returning home from Hong Kong, moving into a new place, and getting caught up at my paying job. Whew! That's a lot of business not at all related to Texas and this is the first opportunity in quite some time that I've had to really decompress and get back into the groove of it.
I did manage, over the past couple weeks, to get clouds implemented. I was always impressed with the clouds in Wind Wakker:
The clouds, if you've played the game, are made up of puffs that kind of moosh in and out and seem to fade and grow/shrink. Everything about this game is striking, and so I say: Zelda The Wind Wakker ho!
So I made a similar effect for Texas: clouds made up of puffs that kind of moosh in and out. Here is how it works internally:
1. You have global wind vector and air density function. The air density function is just a 2D noise.
2. You have many "puffs" which are essentially floating rectangles with position and radius data.
3. The puffs move according to the wind vector, plus or minus a certain randomized amount.
4. The puffs grow and shrink, and alpha fade according to the air density.
5. The air density (think: moisture, not really air density) function includes an offset which moves at the wind speed, so it roughly tracks the wind.
6. We render them a bit fancy to get a nice "silver lining" effect and handle transparency.
7. As puffs move off the edge of the screen, they are reborn randomly at the other side. They are uniformly distributed.
The effect of the air density and the puffs is the most interesting. What happens is the air density function actually determines where the clouds lie, and the puffs act as a layer to visualize them. Since the puffs move at a slightly different rate as the air density function, the "clouds" appear amorphous and seem to grow in and out. It helps a lot that the puffs don't just fade, but also grow and shrink.
That's, my friends, how clouds work! Now I just need to work out some stencil effects for rendering them with area-to-area wipe transitions, and as reflections in ponds. Here we go!