Creating a cloud-like effect
To create a texture that resembles a sky with clouds, we can use the noise values as a blending factor between the sky color and the cloud color. As clouds usually have large-scale structure, it makes sense to use low-octave noise. However, the large-scale structure often has higher frequency variations, so some contribution from higher octave noise may be desired.
The following image shows an example of clouds generated by the technique in this recipe:
To create this effect, we take the cosine of the noise value and use the result as the blending factor between the cloud color.
Getting ready
Set up your program to generate a seamless noise texture and make it available to the shaders through the NoiseTex
uniform sampler variable.
There are two uniforms in the fragment shader that can be assigned from the OpenGL program:
SkyColor
: The background sky colorCloudColor
: The color of the clouds
How to do it...
To build a shader program that uses a noise texture to create...