Cloud generation within the Reach profile
Sometimes a 2D image of cloud just isn't going to cut it.
Maybe your game needs some fluffy, white, 3D clouds to fly through or there is some dramatic and dynamic change of weather.
In either case, knowing how to generate a 3D cloud programmatically is a good place to start.
Getting ready
A cloud particle texture is required for this recipe.
Since it will be replicated and rotated repeatedly to make up a cloud, any random collection of white or grey dots on a transparent background should do the job nicely, as seen here:
How to do it...
To start rendering your own in-game clouds:
1. Create a new class named
ReachCloud:
class ReachCloud {
2. Create the instance-level variables to hold the details common to all the particles that go towards making up the cloud:
SpriteBatch spriteBatch; Texture2D cloudParticleTexture; Vector2 cloudParticleTextureOrigin; const float cloudDensity = 2f; const float scale = 1f;
3. Add the instance-level variables to describe the...