Projection Mapping a Japanese Garden

A short sequence of an animated door that generates before opening into a garden with a Cherry Blossom tree that grows and scatters its blossoms across the room.

(Original Post from the Goldsmiths Department of Computing Blog can be found here.)

Introduction

     Have you ever dreamed of seeing the Cherry Blossom trees in full bloom in Japan? Projection Mapping a Japanese Garden is meant to evoke the imagery of what your mind imagines it might be like, and is based on my own experiences seeing them in person. And as a playful experiment with perspective, this piece is designed to play with your expectations, by selectively displaying portions of the animation on different surfaces to encourage movement and change in perspective in those who are viewing it.

     Four doors open into a garden, where a Cherry Blossom tree is growing, and where the roots or the tree can only be seen if you look at the piece from a particular angle, and when the blossoms are scattered across all surfaces near the end of the animation, viewers are again challenged with adjusting their perspective to decide how it appears to them. Watch for yourself, and decide which perspective you like best!

Concept and background research

     The initial inspiration for this project originally came from my experiences in Japan while watching cherry blossom trees scatter their flowers in the wind along the riverside on the Philosopher’s Walk in Kyoto and from my experiences this term in learning how to write recursive functions.

     My original plan before knowing what our shape was going to be like was to have two additional scenes that were also based on experiences from my travels in Japan. However, those ideas ( a rising sun, and headlamps climbing Mt. Fuji) didn’t translate well to our shape, which is composed of four rectangular surfaces and two triangular surfaces oriented like a folding screen. When discussing my ideas, and how to translate them to our chosen shape with artist Jane Prophet (who has her own project in cherry blossom growing), she described one way would be to use chinese doors as a method to indicate passage into a scene containing the tree I wanted to learn to build because they contained interesting geometric patterns that fit well within the scope of the assignment. She also inspired me to pursue using L-systems for the project, and while I was not able to implement them, they are next on my list of subjects to pursue in my independent study.

     I then decided that I would have enough to make significant change throughout the animation by creating the doors, opening and closing them, and finding a way to create my cherry blossom tree. To do so, I returned to the source that inspired me while learning to make recursive functions for a previous assignment, Daniel Shiffman. His exercises from his book, “The Nature of Code” helped me learn to write a recursive function, and his coding tutorials (here and here) on YouTube helped me form a basis for learning to draw the tree. Because the tutorials are written in Processing, I would have to take the concepts and apply them to open Frameworks. Rui Pereira’s chapter, “Ooops! = Object Oriented Programming + Classes” taught me the necessary additional skills to follow along with Daniel Shiffman’s Object Oriented Fractal tree tutorial.

     Once I had learned from both, I was able to experiement with the behavior of the tree, and add additional effects (like Perlin noise) and changes (like a “middle” branch function for the tree that felt more natural to me) to make the animation look the way that I had envisioned.

Technical

     Projecting a Japanese Garden was built using openFrameworks with two add-ons: “ofxJSON” for scene management, and “ofxPiMapper” for projection mapping the animated elements onto the sufaces of a primitive shape. The shape was an “accordian-like” shape, similar to a piece of paper that has been folded lengthwise into four equal parts, that has been laser cut from a white corex material for transparency and brightness. The entire animation is created from four individual scenes, that each use different specialized techniques to create the images in the scene.

     The first scene has three FBO sources displayed over the surfaces of the accordian like shape to show the creation of a chinese-style door as if light is etching the screen onto the door itself. The points of light are agents that have position, direction of travel, starting points, and time to change direction stored within a vector to produce the effect seen on the screen. The points of light are then also displayed as a separate source on the triangular floor against a different background to give the impression that light is being cast against the floor. The door itself is a series of functions that use a switch statement to determine the behavior of the door for each scene. In the first scene, the door is static.

     And in the second scene, the door opens by rotating the door object along the y-axis. A background is generated that has a dirt and sky color splitting the rectangular surface in half. The triangular, floor shapes have their own FBO source that is meant to have a floor-like coloring, and also contains a switch statement so that the FBO source can recall which scene it is (because the floor will be covered with cherry blossoms during the next scene).

      In the third scene, the same FBO source is used on the triangular surfaces while two new FBO sources are applied to the rectangular surfaces. One, which uses two additional classes to create a recursive growing tree and a set of cherry blossom objects that are instantiated at the endpoints of the tree when it has been fully grown. The other FBO source is for the roots of the tree, which grow at different lengths and angles than the tree so that they appear different. All of these objects are contained within vectors that can be used during the scene. Once completed, perlin noise is applied to the position of these objects in the vector to give the appearance of wind, before applying an additional change to the position of the blossoms in the Y direction to give the appearance of gravity. Once they hit the floor surfaces, a new animation is started there with circular objects being pushed back into a vector with randomized x and y positions within the limits of the FBO source. These objects are kept within the source for the final scene.

     The final scene includes a number of objects collected from previous scenes. The floor surfaces have blossoms littered across the surface from the vector containing their positions (which is cleared after the scene is complete), and a new version of the Chinese Door source is run that shows the door closing over a new version of the background. In this version, a placeholder version of the tree and roots from the previous scene are created with a recursive function that has an exit condition when the length of each branch/root is under 4 pixels in length. It is by no means exact, but meant to display that the tree has a level of permanency between the scenes. When the animation is run again, each of these sequences start again with entirely new patterns on the screen, for the tree and root system, and for the positioning of the cherry blossoms by randomizing variables (such as length and thickness) for each object.

Future development

     First, as I learned how to create new classes of objects for use in the Cherry Blossom tree, I realized that it would be a far more elegant solution to the way that I was drawing the screen onto my chinese door. If I were to develop the project further, this would be the first change that I would make, as it would give me greater control over the “points of light” on the screen of the door, and allow me to include them within the same FBO source (because at the moment they are separated).

     Second, although the color palatte of my demonstration is deliberate, I would love to find a way to randomize the colors in such a way that there is even more potential for interesting interaction. I would need to find a way to carry this color across scenes and classes of objects and reset only once my animation is called again at the beginning.

     Lastly, I would love to do further research into using L-systems to produce growth for either the tree itself or the root system to make a slightly different system of growth for either.

Self evaluation

     I’m really proud of the work that I did with the tree and root system. I feel that it was a massive challenge to look ahead and learn how to incorporate object-oriented programming in openFrameworks and apply those lessons to translating Daniel Shiffman’s Processing-based trees to the C++ based openFrameworks. I like the generative nature of each scene, and how the screen, tree, root, and blossoms differ in their positions each time the animation is run.

     What I feel like I could have done better, was to create animations that take the triangular shapes of the floor objects into account. Right now, they run animations based on perspective (leaves being blown in from the outside, and points of light being cast onto the floor) but they don’t necessarily adhere to the shape itself. The movement patterns work as well on a triangular shape as they do on a square shape. And as I discussed in the further development section, I would love to go back and clean up the animation by making the points of lights their own class to be called into different sources.

References

1) “Ooops! = Object Oriented Programming + Classes” by Rui Pereira http://openframeworks.cc/ofBook/chapters/OOPs!.html

2) “Coding Challenge #14: Fractal Trees – Recursive” by The Coding Train / Daniel Shiffman: https://www.youtube.com/watch?v=0jjeOYMjmDU&t=5s

3) “Coding Challenge #15: Fractal Trees – Object Oriented” by The Coding Train / Daniel Shiffman: https://www.youtube.com/watch?v=fcdNSZ9IzJM

4) “Pocket Penjing” by Jane Prophet: http://www.janeprophet.com/?p=518

5) “Online Shop Solid Wood Door Chinese style…” https://m.aliexpress.com/item/32464838913.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s