Grammars

Surfaces are grown using a grammar. The grammar holds instructions for the development of the surface. The grammar is not a blueprint for the final surface, a better analogy is a recipe. The instructions are repeatedly applied to the surface under the influence of the environment.

The grammars are quite complex and in order to use GENR8, a thorough understanding is by no means necessary. There are three kinds of grammars in GENR8, predefined, user-defined and evolved.

It is recommended that you start by using the predefined grammars until you feel that you have understood the growth model and the environment. It is much easier to figure out the effects of the environment if you have a rough idea of what the outcome will be.

Predefined

In GENR8, there are four pre-defined grammars. Two of them produce fractals and they are not very useful for producing surfaces. They are mainly there to demonstrate how L-systems can be used to generate fractals.

The two other grammars are considerably more useful for creating surfaces. They are called tiles, since they are symmetrically subdivided. The grammars were designed by hand. However, attempts to construct a grammar that produces hexagon tiles have so far been fruitless.

Three-sided Tiles

This grammar produces a triangular surface that gets subdivided in to smaller and smaller triangles. The grammar is defined as:

   Edge0 + Edge1 + Edge2
   Edge0 -> Edge0 [ [ [ [ + Edge2 ] + + Edge1 ] - Edge1 ] - - Edge2 ] Edge0
   Edge1 -> Edge1 [ [ [ [ + Edge0 ] + + Edge2 ] - Edge2 ] - - Edge0 ] Edge1
   Edge2 -> Edge2 [ [ [ [ + Edge1 ] + + Edge0 ] - Edge0 ] - - Edge1 ] Edge2
   Angle 60
   Sync

Four-sided Tiles

This grammar produces a square surface which is subdivided into smaller squares. If the surface is not too "distorted", the resulting Maya surface will be a "true" nurbs-surface. In order to construct a nurbs-surface, Maya requires that the vertices used to describe the surface form a complete and regular mesh. With the GENR8 notation, the grammar is:

   Edge0 + ~ Edge1 + ~ Edge0 + Edge1
   Edge0 -> Edge0 [ [ + Edge1 ] - Edge1 ] Edge0
   Edge1 -> Edge1 [ [ + Edge0 ] - Edge0 ] Edge1
   Angle 90

Koch curve

The Koch curve is an example of a fractal, the grammar is:

   Edge0 + Edge0 + Edge0
   Edge0 -> Edge0 - Edge0 + + Edge0 - Edge0
   Angle 60

Quadratic Koch curve

The quadratic Koch curve is a variant of the Koch curve.

   Edge0 + Edge0 + Edge0 + Edge0
   Edge0 -> Edge0 + Edge0 - Edge0 - Edge0 Edge0 + Edge0 + Edge0 - Edge0
   Angle 90

User-defined

The user can write grammars and have them interpreted by GENR8. Writing your own grammar is quite complicated and those readers who are familiar with L-systems grammars can read more here.

Evolved

Using only the pre-defined grammars, GENR8 is a powerful tool. However, there is also a way to automatically create grammars that can be tailored to meet the designer's needs.

Starting from a BNF that is very similar to the one described above, GENR8 employs an evolutionary algorithm to generate grammars. These grammars are fed to the parser and subsequently drawn in Maya. There are obviously an infinite set of possible grammars and in order to be able to search them somewhat more effectively, there is an evolutionary component that does this. There are four types of grammars that can be used for the evolutionary algorithm. The first three grammars produce similar results, while the last one produces grammars that give an altogether different appearance.

Default

The default grammar is specified to produce many branches. This in turn generates subdivisions, generally it is a desired property for surfaces.

Reversible

These grammars can be inverted using regn8.

Symmetric

The surfaces obtained when these grammars are interpreted are symmetric with respect to at least one axis.

Probabilistic

This BNF produces grammars with probabilistic productions. Normally, the production rules are deterministic and thus the outcome will always be the same when a grammar is interpreted. When probabilistic rules are used, different rules will be applied (with a given probability) for each growth step. Thus, interpreting a probabilistic grammar is likely to produce different results each time.