G² (Generalized Grammar)
G² (Generalized Grammar) is a novel procedural modeling language based on the paper "Generalized Use of Non-Terminal Symbols for Procedural Modeling" which adapts various concepts from general purpose programming languages in order to provide high descriptive power with well-defined semantics and a simple syntax which is easily readable even by non-programmers. The term "Generalized" reflects two kinds of generalization. On the one hand we extend the scope of previous architectural modeling languages by allowing for multiple types of non-terminal objects with domain-specific operators and attributes. On the other hand the language accepts non-terminal symbols as parameters in modeling rules and thus enables the definition of abstract structure templates for flexible re-use within the grammar. By deriving G² from the well-established programming language Python, we can make sure that our modeling language has a well-defined semantics. This Project therefore contains a script package for the Houdini Modeling Application. We also provide some example files for the generation of a plant and a simple facade that is build from several modules.
Important Note: The provided script package is a proof of concept for the techniques that are described in our paper. It could act as a starting point for any project dealing with procedural modeling techniques. Please note, that the provided script heavily relies on Houdini and therefore its current performance is orders of magnitudes slower than our C++ implementation which was used to generate most of the images in our paper (like the one that is shown on the right side). There are mainly two reasons for using Python in combination with Houdini for demonstration purposes. First, the fundamental concepts can be explained much better with an untyped and partially functional language like Python instead of a typed language like C++. Second, the professional Houdini modeling software is available as a free apprentice version which is available for the most important platforms. This makes our script easily accessible for a wide range of users.
The provided Python code can also be adapted for your own rendering applications if you do not want to rely on Houdini in your projects. Note, that the bottleneck of the script package is currently the way, how the objects are created in Houdini. The evaluation of the grammar in Python, however, will even be fast enough for your own real-time applications as long as your engine provides a fast way to create and render a large scenegraph. If you have any comments or questions about the script package, please contact Lars Krecklau
The installation of the script package is very easy. First of all, the Houdini modeling software from SideFX has to be downloaded and installed. There is a free apprentice version available for download on their website (http://www.sidefx.com). Once this is done, the program can be started and a new shelf can be downloaded by clicking on the little plus sign in the topmost toolbar and selecting the entry "Download shelf..." from the menu (cf. Figure 1). A new window will open with a default location for downloading content. Here, the location of the G² script package has to be entered (http://www.graphics.rwth-aachen.de/software/generalizedgrammar/download). After the URL was typed in, the entry "Generalized Grammar" has to be selected from the list and the download button on the bottom of the window has to be clicked (cf. Figure 2). A dialog should appear, which states that the installation was successful. Finally, the new shelf GeneralizedGrammar, which provides two buttons, should be available (cf. Figure 3). When the buttons are created the first time, they will have a H logo. This changes as soon as the button is pressed. The first button (i.e. From File) will load and execute a grammar from file. The second button (i.e. Evaluate) will execute the last loaded file again. This is easier, if the grammar file or any of the system files have changed.
Version 1.0 (23.02.2010):
- First prototype of the generalized grammar in python with support for Houdini. Includes some grammars as a proof of concept.
Version 1.1 (29.04.2011):
- Fixed a bug such that the operators '&&' and '||' will now work properly in any expression.