Programming Complex 3D Meshes. A Generative Approach Based on Shape Grammars

This article summarizes the results of art based research developed thanks to a grant of the PUCP University of Lima in 2021 2022. It will be described an open source generative solution, based on generative grammars to create very complex and programmable 3D meshes. Analyzing hundreds of models generated with these algorithms, it was found a solution based on the idea of “intelligent meshes”, which change their behavior during the modeling process. This is done using tags, or vertices identifiers, that, like genes, describe the topological characteristics of each vertex and i ts generative development during the process. Tags can be pr ogrammed interactively editing its data with tools provided by the interface or using generative grammars that allow an incredible variety of complex forms and stimulate the user creativity. The research findings also elucidate some important conceptual issues, like the importance of original technology development to defend cultural identity.


Introduction
Creativity is a key issue in arts, science and cultural industries, not to mention that it is of the greatest concern for innovative educational programs. But creativity is a difficult topic to be handled properly. I t is enough to mention just three problems: creativity is hard to define, explain and measure [1], its aesthetic meaning and aura are jeopardized by postmodern art [2], over production and media saturation, and, last but not least, the disruptive effect of digital media. To enter directly into the digital matter, today computational creativity, 3D modelling, animation and i mage processing technologies research, such as generative algorithms or fractals, is occupied by the AI and Machine Learning discourse. But AI, not so much paradoxically, leaves small room to users' creativity (Colton 2008) and, spreading Anglo-Saxon computational thinking, is one of the most efficient assets of digital colonization [4]. These are good reasons to develop shape grammars [5] and generative algorithms as a v alid alternative [6], for their simplicity, creative power [7] [8] and because they offer the possibility to simulate natural phenomena and l ocal artistic traditions, like ethno computation [9][10], intuitively and without black boxes [11] [3]. In this paper I will concentrate the attention on software development, visual analysis and artistic practice results. Due to these properties, the generative design tools described in the following paragraphs will be valuable to artists, industrial designers and educators to experiment with new design processes, explore computational creativity as a r esearch or educational tools and t o link parametric design with cultural identity. From the production point of view, these algorithms help artists and designers to explore the relationships between forms and new materials also suitable for 3D printers and robotic fabrication.

Methodology
This paper is the result of an interdisciplinary artistic research project supported by a grant of the PUCP University of Lima. The research methods expand the art based research framework [12] and consist of: a) Review of papers in the field of Computer Science, Digital Humanities and D igital Art, especially generative design, shape grammars and ethno computation topics; b) Analysis of software for audio-visual creative production (DAWs and 3D Modelling software R hino and 3D Max); c) Visual analysis of pre-Columbian art; d) Software development using extreme and incremental programming; e) Artistic practice and digital fabrication with 3D printers and a Kuka robotic arm.

3.1
Literature and Software Analysis Papers about computational creativity, generative art and parametric design show that the potential of shape grammars is not fully developed [13]. Besides, there is a l ack of friendly and interactive generative applications. On the other hand, plug ins (like EuroRack), programming languages (like Processing), game design engines or DAWs (like Unity or Reaper) that use AI or generative techniques and c an be often installed freely, quite often share the same algorithms and lack proper documentation. This is reflected in repetitive and standardized design artefacts.

Analysis of Natural Forms, Pre-Columbian Art and Shape Grammars Simulations
The capability and potential of L-Systems to simulate natural phenomena is well known [7], so it is not necessary to enter into this topic here. On the other hand, Pre-Columbian and traditional ethnic art shows [14] that algorithmic and nat ural procedures were commonplace. As shown in figure 1, there is obviously a computational thinking in the ropes, knots and colours and a c reative hypothesis to use them as a l inguistic code or interface design metaphor to improve usability in shape grammars applications. For instance, the generative potential of quipus was investigated by the neapolitan alchemist Raimondo di Sangro [15].

Software Development, Artistic Practice and Improvement of L-Systems Techniques
Even if a huge amount of research about shape grammars exists, the creative power of symbolic dictionaries, rules and substitution algorithms can be expanded. In existing applications rules are rigid, can't share parameters and programming tools like loops or conditional statements. In previous research [13], were developed improvements to L-Systems dictionary and rule sets to overcome some of their limitations.

Figure 2. Example of symbols for nested recursive substitution
I will mention here just one of these extensions: automatic symbols ("n") with nested recursion and w ith slave or subsymbols ("ñ") controlled by the number of instances, or the master symbol hierarchy in the grammar, or by the level of the substitution process. Figure 2 explains a design that is impossible to build with standard L-Systems vocabulary and rules, since it will be necessary to write a par ticular rule for every column to match the number of blocks and their rotation degrees. Symbol "n" sets the hierarchy of the columns in the row and " ñ" sets the corresponding number of objects: for example, the first instance of "n" sets 1 block, the third instance 3 blocks, etcétera. In this way L-Systems are converted in a sort of programming language, like side chain functions, to link the number of bricks to the empty space between them, and t o match the chakana's grammar to the position and rotation parameters of the growing spiral ( fig. 3).

Software Development and Artistic Production
During the research many generative techniques have been ex plored, using self-similarity, natural processes, and traditional designs' ethno computation. After the generation with different functions and parameters of hundreds of models, were selected two solution that solved the task to create something new. The first is the mesh remix tool set that expands the standard morphing process with additions like masks, side chain modulation, genetic behaviours, shape grammars and c ellular automata ( fig. 4). The second that will be ex posed in the following sections, is the programmable mesh technique.

Generative Programmable Meshes
The algorithm that will be described here is based on t he idea of a m esh that changes its geometric properties during the generation process. Like in cellular automata and finite state machines, the mesh' vertices act like cells whose values describe topological properties, transformation parameters and ot her behaviors. In this way the mesh grows like an or ganic natural process. This is done using "tags", or vertices identifiers, assigned to a pattern of vertices that can be programmed interactively or using L-Systems [6]. This allows for an incredible variety of complex forms, and s timulates the user to experiment freely. In the first step the user creates a pattern of n poi nts (usually a m ultiple of 8 t o match symmetry and bytes) and allocates their alphanumeric identifiers, the tags. This pattern generates a closed shape with 8 or 4 axis symmetry ( fig. 5). Here is where shape grammars and L -Systems come into hand, to create interactively the patterns and change the tags during the process.  Now, during the mesh construction, every point can be t ranslated, scaled or rotated using their tag parameters, and behave independently or interacting with other tags, considering its XZ position in the section and in its height in the mesh (Fig. 6, 7). I n this way every section or slice of the mesh can smoothly change its form without losing the formal coherence of the mesh as a whole. The interactions between points and tags can be done with cellular automata, interactive functions or reading values from data sets or images. The tag rule set can be processed using the usual shape grammars substitution process embedded in the main function (Fig. 8). These data can be saved and combined with the others using the remix tools describe above.

Technical Issues of Complex Generative Meshes
Generative processes like programmable meshes are highly unpredictable (this is the reason why they are so fascinating).
But this comes at the cost of geometrical problems that happens when vertices are heavily transformed and v ertices' positions are too rough. In this sense, tags helps to analyze the topological data without performing tests that, when you are working with more than 1,000,000 polygons, slow down the process too much. The software additionally takes charge of other issues that could result in geometric inconsistencies such as face intersections that cause errors or the need to use support material in the 3D printing process.

Software Development and Interface Design. The Artist as Computer Scientist
Working with complexity, generative processes and art, it results that software development gets very confusing. It is interesting to stress here the different approach to programming of artists and computer scientists. In the present case, extreme and i ncremental programming paradigms where used, but when the programmers are artists, the development is a l ot less linear than expected. While programming needs careful organization and a pr ecise workflow, the artistic experimentation and software development needs improvisation, serendipity and permanent trial and er ror processes that leads quickly to bugs, undesired effects and ineffectiveness. The solution was, in the first place, to experiment freely with the code at the beginning, and rewrite the entire application also improving the user interface design. Through parallel artistic production, it was found that the best software architecture should be modular, to help the user thorough the process step by step, with every step enabled by its predecessor and the compatibility of geometric properties. The interface accompanies the workflow with instructions and examples on how to use every function, to make the learning curve as smooth as possible. Finally, considering the open s ource philosophy of this application, the code was revisited in the literary sense, and considered as a text in its full right.

Discussion
Setting apart the artistic and t echnical benefits, the research findings also elucidate some important concept issues about computational creativity and education.

Original Technology Research
In the first place, software development and artistic results exposed the importance of original technology research. This infers "reinventing the wheel", in other words, to develop algorithms or functions are already available in internet. The true of this lies in the fact that real innovation comes from the deep understanding and control of every layer of the process; on t he contrary, the use and abus e of libraries and ready to use solutions, that can be helpful to speed up production, generate creative constraints -the proper word should be cages-which creative results are not of the artist. Original technology research is paramount also in the broader cultural domain, to defend cultural identity and correct the ideological biases [9] the commercial modelling solutions for artists, designers and ar chitects. Every single line of code embeds significant knowledge that will unfold completely when all the pieces are put together, giving to the software and t o its users cultural definition and power.

The Black Box Problem and the Benefits of Generative Grammars Solutions
The computational and ar tistic research results demonstrate that complexity and creativity forms don't need complicated technological solutions; L-Systems, in this sense, have many benefits. First, with some improvements, offer control and flexibility almost like a pr ogramming language, but are easier to understand (yet certainly difficult to develop properly). In the second place, L-Systems grammars and c odes are transparent, and m ore intelligible, compared, for instance, with AI algorithms [16] whose deep computational processes are puzzling even for their creators. I will add that AI can be developed starting from the fundamental idea of meta-medium [17] and can be interpreted as interfaces architecture and des ign in any application. Also the difficulties of generative design can be l imited with a proper interface design and coding style, both help the users to exploit the parameters' creative properties and t he aesthetics properties of algorithms [18]. It is important to reckon that many independent and open s ource solutions are discarded because of lack of documentation.

4.3
Issues in E ducational Technology These topics are particularly relevant when digital tools are used in learning contexts [19]. Generative grammars lingos, like L-Systems, not only can be programmed easily, even without experience, but also, very much like Turing machines, they can be developed by hand [21] and can be used as methods in analog processes with traditional materials. Even in digital processes, the need of computers appears only in the last step of the design process; in this way machines do not interfere with the development of a creative and critical computational thinking. In this sense, cultural identity and ethno computation references and r esources, like quipus or the yupana, are not just visual metaphors for interface layouts or artistic installations. Embedded and coded in algorithms and f unctions and supported by analogies in design methods, data structures and computations, cultural traditions come to life to shape contemporary culture as concrete methods, solutions and fabrication tools.

4.4
Conclusions To finish, I will resume the main concepts and findings of the research, and s ome ideas about its future developments and improvements. Fig. 9. Generative grammars and programmable meshes can simulate different artistic styles, and hel p to understand their formal processes.

a)
Generative grammars proved, through artistic practice, that are very creative tools and that there is no need of machines to foster digital literacy and computational thinking. Using traditional techniques and materials overcomes the techno centric bias that educational technology carry out [11]. b) Cultural traditions, native artistic practices and ethno computation are inherently modular and r ecursive, thus and can be molded with shape grammars and the tag solution discussed here smoothly ( fig. 9). c) Generative art and generative grammars are techniques with a great creative and heur istic potential, as software development demonstrated during the project activities. From the aesthetic and epi stemological point of view, the artistic research validation can be sustained precisely by this heuristic potential, whose evidence is the artistic production and its diffusion in design communities. d) Software development and artistic practice also discovered some geometric and t opological problems raised by complex generative processes. But the programmable tag mesh solution minimizes this issues and f acilitates the compatibility with digital fabrication and demonstrated that complex forms can improve competences in 3D printing and robotic manufacture and t he possibilities of recycled organic materials (Fig. 10).

Fig. 10. Complex meshes to adjust 3D printing process
Setting apart technicalities, this computer interdisciplinary research also enlighten some interesting concepts about computational creativity and the relationships between computational creativity and education. a) Writing our own functions and giving up the cut and pas te of software libraries may seem excessive, since requires hard work and a s ort of "rediscovering the wheel" process. But this is necessary for true digital literacy, technological innovations and c reativity. In fact, the control over these pieces of knowledge (algorithms, processes and parameters), we eventually miss using libraries lightly, is the key to add aesthetic value and originality to our projects. b) It should be paid a lot more attention to the cultural aspects of software and i nterface design. Software is a complex cultural object with many layers of meaning that still we are not taking advantage as such. For educational and ar tistic purposes of computational thinking and creativity, the artistic research enlightened the differences between coding and software. Software is more than writing code, includes interactivity, the coherence between ends and m eans, cultural biases, issues about the distribution of information of knowledge. So far, software as cultural object needs much more humanities than sciences.

4.5
Further development Generative design methods like shape grammars and t echniques like programmable meshes can be indefinitely developed and improved from the computational, aesthetic and educational point of view. I will mention some lines of research in digital humanities that seem particularly important: to develop interface designs and human-machine interaction strategies for creative purposes; explore software as a t ext, in the sense defined by [20], that gathers technical and creative means, data, concepts and audiovisual resources; and f inally, strategies and pr ograms to improve the interdisciplinary formation of artists as inventors and scientists.