332 CHAPTER 10: OpenGL ES 2, Shaders, and...^
Here’s what is happening:
Line 1 is merely declaring the new cloud_texture.
In Line 2, we pick up the cloud color from the cloud sampler object.
The new color is filtered and merged with the earth’s surface image,
lines 3ff. The numbers used are quite arbitrary, but they give the best
image. Naturally much of the finer detail will have to be cut out to
ensure the colored land masses show through.
Since the clouds are grayscale objects, I need to pick up only a single
color to test, because the normal RGB values are identical. So, I opted
to handle all texels brighter than .20. Then I ensure that the alpha
channel is 1.0 and combine all three components. The cloudColor is
given a slight boost with the 1.3 multiplier, while the underlying surface
uses only .4, so as to emphasize the clouds a little more while still
making them relatively opaque.
I hope you’ll see something like Figure 10-7. Now it’s starting to look like a real planet.
Figure 10-7. Putting it all together