![]() |
|
Neat and very nice ! My new wallpaper.
http://elasticogadget.files.wordpress.com/2012/09/capt.gif
I figured as much,but was a lazy ass to write the code myself. :D
Good job anyway.
Not the code, but the algorithm is very simple. I just randomly get the main trunk height, for every pixel upwards I check if it should branch out. If it should, then it goes to left/right for a specific amount and goes up by the height of the branch. At the end of the trunk and branches a rectangle is drawn, which is proportional to the length of the trunk/branch it's connected to (proportional as in multiplied by a factor and also added with a random value to make it look neater and less repetitive)
That doesn't include the polish (shadow lines) generation, which are simply darker lines on the left of the rectangles and lighter lines on the right of the trunks/branches.
For the terrain, the top snow layer is a basic pattern. The dirt has 2x2 and 5x5 squares placed not totally random (when I did fully randomized generation a lot of them overlayed eachother) but with a kind of complex equation that uses a couple of randomization parameters to have a neat look. The moon is 24x24 and use a an equation very similar to the dirt's, it has the same shadow effect as the rectangles.
And lastly, the snow/stars (whatever you want them to be) is just randomly placed. Little ones have 80% (0-3 in 0-5) and bigger ones have 20% chance of being placed.
I think it's not really that simple...
Shadows on the trees should not be on the side facing the moon.