Marek Paterczyk's Home Page

My unprofessional portfolio



Turtle3D

A Java3D application developed for my master thesis. It allows to generate 3D fractals defined with formal grammars (L-Systems or Language-restricted IFS) using turtle graphics. OpenGL/DirectX visualization is available for preview. Generated objects can be exported and used in popular 3D packages (3D Studio Max, Maya, Blender, etc.). This program is a successor to an earlier work of mine - LSystems application.

Turtle3D is suitable for making trees and plants, you can also create classic fractal shapes (like Sierpinski Pyramid) and other abstract fractal structures. See the gallery.

The features are:

  • Parametric and context sensitive L-Systems support
  • Language-restricted Iterated Function Systems support
  • Grammars and visual symbol interpretations set independently
  • No special parser, grammars are defined as java classes (compilation at runtime)
  • Wavefront .obj import/export
  • GUI allowing to choose grammars, visualizators, set parameters and preview results
  • Simple OpenGL or DirectX visualization
  • Multiplatform (Java)
Table of contents:

Installation

What you need:

  1. Java Runtime Environment 5.0 (or above)
  2. Java3D 1.5 (or above)
  3. Turtle3D

This is enough to try out and tweak parameters of already defined grammars and visualizators. To define your own you need to have JDK installed. JAVA_HOME variable must be set for the compilation at runtime feature to work. See Defining new grammars and visualizators.

Instructions

Choose a grammar and visualizator, set number of iterations (better start with some low value) and parameters and click the "set" button. All grammar-visualizator combinations are allowed, but not all give interesting results. Experiment, it's all self-explanatory ;)

Defining new grammars and visualizators

Turtle3D comes with a collection of grammars and visualizators defined in "plugins" folder. There is also "objects" folder containing 3d meshes used by visualisators. Defining new grammars or visualizators requires little Java programming experience.

To define your own grammar or visualizator (symbol interpretation rules) you need to extend Grammar or Visualizator class, respectively. Put the newly created classes in the following folders:

  • plugins/com/turtle3d/user/grammars
  • plugins/com/turtle3d/user/visualizators

Examine already defined classes. Some of them have comments. You can start with SierpinskiPyramid.java (grammar) and Pyramid.java (visualizator). For a more complicated, parametrized example you could look at Tree3.java (grammar) and Tree2.java (visualisator). The .java files can be edited even in Notepad, but doing that in some Java IDE is a lot nicer (add turtle3d.jar to the project). Turtle3D does compilation for you, so all you need to do is edit a file and then click "set" button to generate your fractal.

If you want to use this program and - despite this comprehensive instructions ;) - you have problems with that, please contact me. I'll be happy to help.

Project Documentation

This lousy javadoc.

Known Bugs

  • There is a problem with reducing vertex number during export to .obj. Sometimes vertices that shouldn't be merged are merged, which results in polygons getting flipped. This affects for example the Menger Sponge. The workaround is to use slightly smaller cubes (the sponge is made of them), so that there is a little space left between them and vertices won't be merged.

Sources & Build

This project is available under GNU General Public License v2.0. Check it out from Google Code SVN repository.

If you're looking for 3D turtle implementation, L-System symbol rewriting engine or a hint on how to export Java3D scene to Wavefront .obj format, then you might find this code interesting.

Use ant to build Turtle3D. A folder named "objects" is required in project root, you can get it from turtle3d.zip.

?>