This sample was written by a member of the site, Jan Vytlačil. You can write your own tutorials as well, learn how under the “Tutorials” tab.

Description: This post contains source code of two new components. First component provide function of dynamic sky with adjustable daytime and dynamic procedurally generated clouds. Second component adds very simple rain particle effect.

Basic part of the sky is a sphere model. Color gradients which are mapped onto the sphere are saved in one 64×64 texture. More about this method form J. A. Abad can be foun at http://www.geocities.com/ngdash/whitepapers/skydomecolor.html.

Clouds are compound of several transparent layers. Transparency of these layers is given by a Perlin noise texture. Way of generation is assumed from Riemer’s 2d Perlin noise tutorial. Layer colors depend on a color of the highest layer which is dependent on daytime. Colors of the other layers are computed by a simple shadowing method. The method make darker those pixels which are shaded by a layer above. Method output is a RGBA texture for each layer.

Link: http://cid-f101b99b3d4bc3a0.skydrive.live.com/self.aspx/.Public/dynamic_sky.zip

Here is how to control the sample application:

1-4 select one of a four predefined components settings
F1-F12 set number of cloud layers
T shift daytime
O increase overcast
P decrease overcast

screen11

« »