3D Dragon Tree IFS.

3D DTIFS is a demo of a method for creating a 3D Dragon Tree from the use of IFS.

The tree is actually only the stem and scaled and rotated copies of the stem in a number levels, (18). In the last six levels the colour blends from brown to green to make it look like leafs. At first the tree is initiated by choosing the number of branches per node. Then the transformation-rules are randomized, one rule per branch respective. Then the transformations starts. Origo for the room/space is where the stem meets the ground and there is the center of rotation. The function first randomizes a point at the stem, (angle & heigth), then the point is written to the scene. This point is then scaled and rotated¹ according to the rule, (that is one of the 2 - 6 branches) choosen by random by the system, (a new random is choosen for every iteration). After scale - rotate the point is translated by the full lengt of the stem² and then written to the scene again and one iteration of the system is done. It does this for all 18 levels before a new point of the stem is choosen and transformed.

¹ Rotations: The rotation is first done around the z-axis, 0 to 150 degrees to make it lean, (when the angle is randomized initially the priority is set so the lower values are prefered, (RND*RND*RND). Then the branch is rotated around the y-axis 0 to 360 degrees to it's choosen side of the stem.

² This will make the initial stem, now scaled and rotated, become one of the branches in the first node. If it is done twice? It will become a branch of the first node of one the branches in the first node of the tree =) A.S.O.

Click to download the latest version: 3D DTIFS.zip

Screenshots from the program: Later!

To run the demo you will need Win32 & DirectX, (my Win98se uses DirectX version 9.0c and it works fine), I'm using DirectX SDK version 5 for development, (only small parts of Direct-draw is used to create a view-port, (screen) and get a pointer to the video memory at the graphics card). It also needs a bit (like 40 megs) of free memory to run, (used for the pretty large image & Z-buffers)).

SunCode

See also:


Images:


A Dragon Tree:


A dragon curve tree. (click to enlarge)

Scaled & cropped:

Troll tree, extream backlight. (click to enlarge) A closer view (click to enlarge)
Weedy tree (click to enlarge) Sierpinskis tree (click to enlarge)

Zoom:


Outside my window. (click to enlarge)

Images from the fifth editon, better end result from a new idéa. In the first pass the shadow map is compleated. Then, by pressing [C] It will start to render in the second pass using the previously compleated shadow map but redering a tree that hat got a sligt thicker stem and branches. From this near surface pixels at surcaces that is in the elucidation newer gets shadowed by the previous surface, (that is in the shadow map). It also uses a new, more advanced, mode for the tree creation. It now has got a 'stub', a 'stem' and 1-7 'branch(es)'. The branches can now get positioned at any (0 < h <= 1) heigt of the 'stub', the 'stem' is always at top of 'stub', (h = 1). There is also a function that, if used, sets the scale ratio for the branches according to the choosen heights, (use scale = scale · height).

New modes from edition six: (click to enlarge)

From left to right: Cubes, sphears and the third image shows the option to write only the IFS-fractal produced by the system, (hera it's using the "FUNKYCOLOURS" that is selectabel by pressing [O] and then use [P]... to choose a random set of colours).


Legal note: The material on this site, including the downloadable program, images & texts are all part of the public domain (PD). Distribute and make copys freely.

Mail: sol_developments (try to direct it to hotmail, use subject = "DTIFS" or something like that, else it will go down the spam drain =)


free web site hit counter