Dynamic Sky & Rain Effect by Jan Vytlačil

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

7 Responses to “Dynamic Sky & Rain Effect by Jan Vytlačil” »

  1. Pingback by ACEWin 01-06-2009 @ XACTly — June 1, 2009 @ 3:33 pm

    [...] Jan Vytlačil’s dynamic Skybox code. This is some excellent work, and really cool to leave sat in my TestEnvironments however, it was written for the #11 Innovation engine source, not the latest and sadly, due to changes in Components/Scenes/Material.cs, it breaks. Sooo ACEWin features both Material classes as a work-around (The old one is ExplicitMaterial.cs and is used exclusively by the Sky and Rain classes right now). I will try and mod the skybox to work with the new materials but haven’t quite got it working just yet. The terrain lighting is also broken, but rather than fix that on the old Terrain class, I decided to complete Tutorial #12 and then try and get it working (will let you know if and when I do ;) ) [...]

  2. Pingback by TestEnvironment 01-06-2009 @ XACTly — June 1, 2009 @ 3:35 pm

    [...] based on the TestEnvironment from the latest Innovation Engine Source, the one from Jan Vytlačil’s dynamic Skybox source, and some bits of my own reflecting ACEAudio and Tutorial [...]

  3. Comment by net gamers — June 21, 2009 @ 2:53 pm

    Awesome games site, good work

  4. Comment by MAN9A — July 3, 2009 @ 6:12 am

    I tried to solve the Material.Cs problem creating 2 SetEffect(), SetTexture() in the Material class. And giving all Effects and Textures an exclusive string Name, it runs, but cant see cloulds neither sun. Only stars can be seen in the night hours…

    someone tried to adapt this tutorial to the newest engine version??

  5. Comment by MAN9A — July 4, 2009 @ 3:41 am

    Ok, I solved it. I forgot to call SetTexturetoEffect when assigning texture to materials.
    but its a forced inconsistent method because if I load a no-named effect or material, it could crash when looking for it by name…

  6. Comment by MAN9A — July 6, 2009 @ 12:30 pm

    I had to reverse the lightdir vector before assigning to the Terrain2 object to cast shadows correctly. I don’t know why, but it works…

  7. Comment by Jorgens — July 16, 2009 @ 4:00 am

    This theme is very relevant and interesting to many people.

RSS feed for comments on this post. TrackBack URI

Leave a comment