-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
OpenGL 4 Shading Language Cookbook, Second Edition - Second Edition
By :
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.
Set up your program to generate a seamless noise texture and make it available to the shaders through the uniform sampler variable NoiseTex.
There are two uniforms in the fragment shader that can be assigned from the OpenGL program:
SkyColor: The background sky color
CloudColor: The color of the clouds
To create a shader program that uses a noise texture to create...
Change the font size
Change margin width
Change background colour