Generation of 3D fractals for Web

Introduction

A wide variety of amazing 3D fractals can be obtained by iteration of very simple rules many times. The simple rules lead to very small (1-3kb) algorithms and scripts realized in Java, JavaScript or VRML. The scripts are flexible and can be combined in a library of fractals for application in complex scenes.

It is well known, that as since fractals possess self-similarity on scaling, therefore they can be made by iterations of scaling transformations. In Figure 1 it is shown how the famous Koch's snowflake is obtained by repetition of simple transformations: scaling, rotations and translations.


Fig1
Figure 1. Generation of the Koch’s snowflake.

The initial segment 1 is shrunk three times, then three small copies are translated upward and two of them rotated by +-60 degrees. Then this procedure is applied again to the entire curve 2 to get the next curve 3 and so on.

Unlike the well known L-systems fractals, this algorithm does not need a rather complicated string parser and 3D turtle for its realization. It uses "natural" 3D operations: scaling, rotations and translations and it can be used with any "3D engine" (VRML, Java3D or Java1 applets). Unfortunately, there is no such "built in" 3D engine in present-day browsers.

Fractal Trees and Polyhedra

It turns out that very realistically looking 3D Trees and other Plants can be obtained just as the Koch’s snowflake by repetition of scaling, rotations and translations. Generation of a simple tree is shown below.

Fig2
Figure 2. Generation of a simple tree. VRML demo (press a button).

Initial branch 1 is shrunk two times, then three small copies are translated upward and two of them rotated by +-45 degrees. Then this procedure is applied again to the entire branch 2 to get the next branch 3 and so on. To get a more sophisticated example we need branches of two types.


Fig3

Figure 3. A more sophisticated tree. VRML tree.

We shrink "branch" 1 and translate three copies again but we add a new branch (lower thick line in Figure 3) each iteration. You can see script for this tree below.

Transform{ translation 0 1 0 children
 DEF s1 Transform{ scale .5 .5 .5 children[
  Transform{ translation 0 1 0 children[
    DEF s0 Shape{                        #   leaf
     appearance Appearance{ material Material{ diffuseColor 0 1 0}}
     geometry IndexedFaceSet{
       coord Coordinate{ point[0 0 0,.1 .5 0,0 1 0,-.1 .5 0]}
       coordIndex[0 1 2 3] } }
  ]}
  Transform{ translation 0 1 0 rotation 0 0 1 .7 children USE s0}
  Transform{ translation 0 1 0 rotation 0 0 1 -.7 children USE s0}
  DEF b1 Shape{                         #   branch
    appearance Appearance{
      material Material{ emissiveColor 0 0 0}}
    geometry IndexedLineSet{
      coord Coordinate{ point[0 0 0,0 1 0]} coordIndex[0 1]}}
 ]}
}
Transform{ translation 0 1 0 rotation 0 0 1 .7 children USE s1}
Transform{ translation 0 1 0 rotation 0 0 1 -.7 children USE s1}
USE b1
To avoid repetitions and to use the script for any number of iterations it can be realized as a cycle in JavaScript. Different 3D plants are obtained by scaling, rotations and translations:
tree2, tree3, fern, flower and cactus.

birch Remote Kepler's Dodecahedron
Figure 4. A few more examples.

We can use cones for trunk and PixelTexture to make more realistic plant. Random disturbance can be used easily too. "Remote" birch with random crown. One of fractal polyheda, shown in Figure 4, is obtained by scaling and translations transformations too.


3D Lab       tested with "Cortona 3.1" and "CosmoPlayer 2.1"
updated 9 May 2001