Tagged Python

css.php
Student Created Computationally Generated Geometric Design
0

Chance Encounters: Pedagogical Methodologies for Teaching Creative Coding

This paper presents a model for teaching drawing with computer programming, using conceptual and visual characteristics of twentieth century avant-garde painting practices. It examines how this pedagogic methodology is then developed to combine, synthesize, and apply these insights algorithmically, using the Python programming language, to produce generative artistic forms that can be evaluated and iteratively refined. The learning unit’s goal is to provide media production students with a tangible formula to continually build their critical, creative, and technical skills as they engage with visual culture.

We often overlook how much of our lives hinge on chance events. From the economic, geographic, and educational environments that we are raised in, to our genetic makeup, these chance occurrences can have a far greater impact on shaping our lives than whatever individual efforts we put forth. How might students develop a creative process that embraces these contingencies in their work? How can an educator inspire undergraduate students who may not have an art history or programming background to imaginatively foster unpredictable artistic outcomes through rigorous procedural thinking? What models can be used for students to embrace problem solving and play in assignments?

I consider these questions in Creative Code, an undergraduate course intended to explore the concept of computer programming as a creative endeavor to produce algorithmically generated artwork. This class provides a foundation in computational skills and aesthetic systems in preparation for advanced classes in programming for gaming, physical computing, and web development in emerging media. In Creative Code we focus on crafting algorithmic poetry, drawing, and sound production using different coding environments and aesthetic tactics to learn essential programming skills. For this unit I model an aesthetic and technical methodology that demonstrates how to identify concepts like chance, constraint, and repetition from the analysis of artistic and programming examples. We then combine, synthesize, and apply these insights to produce new hybrid artistic forms that can be evaluated and refined so students have a formula to continually build their critical, creative, and technical skills.

Presentation and Discussion Methodology

The teaching sequence begins with an analysis and discussion of representative artworks then shifts to in-class programming exercises and is followed by a homework assignment that explores and refines algorithmic drawing. To ground our programming work within a theoretical and aesthetic context, we analyzed and discussed Marcel Duchamp’s Three Standard Stoppages (1913). Duchamp’s piece was created by dropping a meter-long string three times onto separate canvases at a height of a meter and then adhering the string’s unplanned placement to the canvas. This approach, known as using a ‘chance operation’ within the field of the arts, is a process that leaves some element of randomness in the outcome of the artwork. During our discussion of the piece, I asked the students why artists would be interested in incorporating random elements into their authorial vision. I was surprised by the variety of the answers they provided: students gave examples of unpredictable moments that connected to their daily lives, from unexpected delays on the subway to disruptions in internet service. Students suggested that artists who work with chance may be interested in bringing the arbitrariness of existence into their artistic practice.

We then turned our attention to the use of constraint systems, a set of rules or restrictions that limit the range of possible materials, treatments, or outcomes for the creation of art. In the case of Three Standard Stoppages, we saw how there were limitations put to aspects of the piece to give it unity and cohesion, like the fact that each string was the same length and dropped from the same height. These constraints allow for the chance act of the dropping of the string and its physical movement through air, and memorializing the incidental physics at play to have more of an impact in the comparisons when viewing the three pieces together. In addition to Duchamp’s piece, we also looked at the drawing process of contemporary artist Sougwen Chung and how she incorporates chance behavior of traffic patterns in New York City as part of the mark making process in her collaborative artworks with robots. In her duet painting performance Omnia per Omnia (2018), a video camera’s live feed of a traffic intersection in Manhattan is analyzed by a motion engine software analytics program developed at Nokia Bell Labs. Information about the walking patterns of pedestrians and cars is then sent to a swarm of robots that are painting on the same canvas as Chung as she responds to their lines and shapes. The piece mixes chance and constraint because the behavior of the individuals at the intersection is unpredictable but limited by the use of just one particular intersection. The traffic signals function as a set of rules that guide behavior and there is a filtering of the data from the computer vision so only higher-order statistics are sent to the robots for their drawing patterns, not all the data collected (Chung 2018). In discussion of both artworks, the function of repetition was also considered, noting the importance of repeating a process over time for Duchamp and the use of multiple robots creating a small swarm of drawing collaborators with Chung.

This introduction to chance occurrences, constraints, and repetition was then followed by an additional presentation of artwork created in the Russian Suprematism movement, an approach championed by Kazimir Malevich, El Lissitzky, and Lakov Chernikhov. These artists wanted to move away from figurative painting, its history and connotations; they wanted to exclude all imagery except primitive geometric shapes. By critically looking at artworks created in this movement we noticed the parameters that the artists used to produce an infinite variety of imagery through the manipulation of the elements of art and design. The artists used variation in the length of lines in their artwork, the thickness of the lines, the hue, saturation and brightness of the colors of the geometric shapes, and location of the placement of objects on the two-dimensional plane.

In-Class Exercise

After our discussion and analysis of Duchamp, Chung and the Suprematists, the first computer programming exercise was introduced: create an algorithmic drawing that incorporates chance occurrences that is inspired by the Suprematist manipulation of basic geometric shapes. As a conceptual starting point for tackling the exercise we looked at taking the elements of design we identified in our analysis of the images (line, shape, color) and identified how the parameters that give them a specific character (width, length, hue, etc.) can become variables that can manipulated in a computer program. By creating a variable for the length of a line, the thickness of a line, the hue, saturation and brightness of the color, the size, height, and width of the geometric shapes, for instance, we would then be able to assign values from a random number generator in Python to these parameters. Each time the computer program is run it would draw a geometric shape where random variables determine the width, height, location on the screen, and color and then determine different variables the next time it is run.

Student Created Computationally Generated Geometric Design
Figure 1. Student artwork created with Python programming inspired by the Suprematist movement.

To help students get started on their first algorithmic drawing, a starter file was provided that offered an example of how a line can be drawn as well as a simple shape with the Python library TkInter. In the sample code, one variation for manipulating the hue parameter was shown and it was left to the students to continue to build on many of the additional parameters available for lines and shapes.

Once students had completed the first exercise, a second exercise scaffolded skills learned in a prior class by applying a programming technique called a “for loop.” This is a technique common in many programming languages that enables the programmer to repeat a process a designated amount of times. Students were asked to use a “for loop” to draw one hundred lines or shapes that feature randomness in their drawing. So instead of drawing just one element at a time with a block of code, the goal was to create an algorithm that could generate multiple iterations of a line or shape with varying parameters for each iteration of the “for loop.” Essentially, students could wrap the code from the prior exercise and automate the running of it multiple times. Once students were able to get this second exercise working, we took a moment to evaluate the output. This is an important step in computational art: students learn that although we are handing over some of the control of the artwork to chance operations, the artistic process is still iterative and evaluative. Just as the process of painting or drawing incorporates decisions on whether to erase or refine certain areas, in the digital realm we also look to see if we are getting the behaviors we find aesthetically compelling from the program and hone the code based on our impressions. For instance, if we feel the colors are too saturated or the lines are going too far over to one of the edges of the image, we can modify the parameter ranges to create the impression we would like to communicate.

A screenshot of small amount of code illustrating the For Loop in Python
Figure 2. “For loop” in the Python programming language.

Picking up on our conversation about constraint systems from Duchamp and Chung, we considered how algorithmic constraint systems could be introduced into our programs. How could limiting the ranges of possibility create a striking visual impact for the work? How could limiting the placement of object on the screen or patterns of overlapping shapes add to the composition’s complexity? The students were encouraged to think aesthetically about the possible ranges for their chance parameters and the use of repeated procedures in artistic expression. Some students created a set of monochromatic colors choices that vary in their amounts of brightness and saturation while others only used circles for their design. During this exercise we discussed how constraints and chance can co-exist within an artwork and it can generate a productive tension within the work.

Homework Assignment

This sequence of in-class presentations and exercises was intended to lay a technical and aesthetic foundation for algorithmic drawing and foster a creative interest in the subject that could be expanded upon with new techniques in their homework. For their take-home assignment, students were given a chapter to read on Object Oriented Programming from their textbook and asked to creatively apply these concepts to their algorithmic drawings from our in-class exercises, converting the code they had written to be used with objects and classes in Python. Their final submission was to include two algorithmic drawings, one based on Suprematists geometric abstraction and the other using a “for loop” to create more than one hundred instances of an object. This homework assignment also required scaffolding knowledge of color theory from a prerequisite class. For each drawing they were to use a color scheme, such as monochromatic, complimentary, split complimentary, or analogous, which drew on their design knowledge to create a unified visual look for their piece. In that previous course, they learned how to create a color scheme with a graphic interface in Adobe Photoshop; however, in Creative Code the color scheme was to be created using programming in a text editor.

Outcomes and Reflections

One of the outcomes of this sequence in the class is to enable students to look at their daily visual surroundings and to consider how aspects of art and design might be created computationally. How can I make something I see? How can the elements that constitute an image be turned into variables that can be programmed and automated? This process can help students improve their problem-solving skills and improve their ability to think programmatically and break down ideas into smaller achievable steps. This attention to their visual surroundings can also foster a greater sense of play between analysis and creativity that supports and refines both of these areas.

Not only was this exercise/sequence intended to model procedural thinking, it was also intended to model a methodology for developing a creative computational practice. By fusing two different artistic approaches in this exercise (chance operations and Suprematist geometric abstraction) with two programming approaches (generating random values and looping repetitions) I modeled a framework for making computational artwork. This mode of production emphasizes remixing both the artistic influences and technical skills the student has learned to synthesize these sources and yield inventive new creations.

One issue that this exercise clarified for me was to reconsider the choice of software that is appropriate for both computational poetry and algorithmic drawing. The TkInter library is a little opaque in aspects of its organization and can be confusing for a student’s initial exposure to working with code. The Processing programming language seems far better suited for first time users to begin creative explorations with their drawings. I was worried about shifting between three programming languages in one semester, from Python to Processing and then to Max for the audio and video processing, denying the feeling of proficiency in any development environment. For future iterations, I will remove Python from the course even though it allows for a much wider variety of textual analysis and manipulations for our computational poetry work. I plan on using this assignment again, this time with the Processing programming language, and comparing the results.

After looking at the student submissions of their homework, I was surprised by the variety and overall quality of the graphics from these emerging coders. I have found that the undergraduate students tend to produce some of their best work when the exercise is not too open-ended, where there is room for creativity and variation but within a focused field of play. The students seem to enjoy the ability to generate work that was visually compelling without hundreds of lines of code. Based on their in-class reactions, another pleasurable aspect of this exercise for the students was their excitement to produce one hundred or even one thousand shapes based on just a few minor modifications of their program. For the students’ final project, they were able to choose from any of the computationally generated artistic approaches we covered (sound composition, generative poetry, video processing or algorithmic drawing) and over a third of the class used algorithmic drawing as a significant part of the final project, suggesting this combination of exercises, discussions, and homework instilled an interest in diving deeper into this area. Through this sequence, students were able to see the aesthetic potential of programming as a rewarding area for deep creative explorations.

Bibliography

Chung, Sougwen. 2018. Omnia per Omnia. Accessed August 15, 2020. https://sougwen.com/project/omniaperomnia.

About the Author

Andrew Demirjian is an interdisciplinary artist who works with remix, rhythm and ritual. His work has been exhibited at The Museum of the Moving Image, Eyebeam, Fridman Gallery, Transformer Gallery, Rush Arts, the White Box gallery, the Center for Book Arts, The Newark Museum and many other galleries, festivals and museums. The MacDowell Colony, Nokia Bell Labs, Puffin Foundation, Artslink, and Harvestworks are among some of the organizations that have supported his work. He is a Fellow at the MIT Open Documentary Lab and teaches emerging media courses in the Film and Media Department at Hunter College.

Need help with the Commons? Visit our
help page
Send us a message
Skip to toolbar