NOC Week 7: Midterm 3D Noise Visualization – Andrew Joslyn

https://editor.p5js.org/adj311/sketches/XHO-yhlAQ

This begins an exploration into 3D visualization that I plan on both developing and improving as the semester goes on.  My initial concept, as described in class, was to turn a 2D plane-like object and allowing the user to interact with it, and to show the user how his choice on the 2D plane influences the result of the 3D object that is created after “turning on” the sketch, by hitting spacebar.  Unfortunately, the limitations of 3D in p5.js meant that applying transformations to turn a 2D visual into a 3D one was very taxing on calculations and quite limited by WEBGL as a graphics engine, so because of this, I opted for an approach where the user is able to manipulate the size and movement of the noise field, as well as the intensity of the visualization that the noise is mapped to, in order to create differing effects, mirrored and flipped 180 degrees in order to achieve a sort of similar visual effect in 3D space that I intended before, while incurring far less lag. Had I used the native app instead of the web editor, I think that the visual may have been even better yet – perhaps something to look towards in the future when pursuing 3D visualization.

 

I enjoyed working in 3D space and enjoyed the discovery process of p5.js and its capabilities and limitations, and hope to develop a better understanding, and continue to explore and demonstrate a more complex and complete process and visualization for future projects.

NOC – Week 7: Midterm! Dandelions – Susan Xu

Project link: https://editor.p5js.org/Susan_Xu/present/arqz4HEMQ

If sound not working, try: https://editor.p5js.org/Susan_Xu/sketches/arqz4HEMQ

I am inspired by the artwork from my classmate, who used calligraphy techniques and created a dynamic scene of dandelion under wind. Dandelions are one of kids’ (and my) favorite plants in nature. With its wind-aided disposal, one can easily blow off its seeds into air. My goal for the midterm is to model this process in p5.js.

I started by constructing classes Seed and Dandelion, and new Seed object only generated in Dandelion object to limit its scope. Seed has its direction: pointing outward when on dandelion, and pointing upward when they fly off, following the wind direction whenever applicable. In either case, the direction is oscillating within small range.

The wind is controlled by mic input–when you blow to the computer, wind will be simulated on the sketch depending on your volume. The voice volume level is visualized by a jumping circle in the debug mood. When the magnitude of the wind reaches certain level, the seed will leave the dandelion and fly on. When in air, they are still under the influence of wind, for both direction and acceleration. 

The seeds of dandelion are blown apart.

One interesting parameter to tune is the threshold of seeds’ flying off. When the threshold is high, the seed will follow the wind direction but stay on dandelion, and return to its original position when the wind stop. This is also true for some dandelions in nature.

The seeds of dandelions are resilient to wind.

Some feedback I got from class:

  • let the stem of dandelion also swing with wind
  • add more randomness when users blow (eg. random wind direction, random mass of the seed)
  • add natural wind to the scene

NOC – Midterm Project: Pop the Balloons! – Tiger Tian

Date   04/03/2019

Title   Pop the Balloons! (Click to view on IMA nas)

Introduction   I drew my inspiration for this project from a PC game I used to play on my dad’s laptop when I was around 4 years old, which is called “MozPong” (click to view on YouTube). I wanted to make something similar, where player uses a controller to keep the ball from falling to the ground. To make it more interesting, I added the balloons, which player can pop with the ball to score. Once the ball falls out of the screen, the score goes back to zero.

Concepts Involved   Obviously, gravity is a very important physical element here. Nevertheless, the core feature of this project is the collision between the ball and the controller. It is a little bit different from what we learnt about collision in class, because the controller is not an ordinary object – its movement depends on mouse position, so does the velocity. Instead of the regular update method, I used two variables – current mouse position and previous mouse position – to keep track of mouse movement and implement it on the controller while also having a this.vel variable for it at the same time. Besides, repulsion happens between every two balloons, so that they dynamically maintain a balanced distribution all over the canvas.

In terms of the sine function that we newly learnt, I utilized it to make the balloons “inhale and exhale” (alternately increase and decrease in size), and make the fireworks effect when a balloon blows up. To be more specific, I used sine and cosine function to calculate the initial position of the firework particles around where the balloon previously was.

dat.GUI   Thanks to dat.GUI, I added a debug mode to the project. It’s a boolean variable, and if you tick the box at the top right corner, you can see what all the velocity vectors are actually like – their magnitude and direction – including that of the controller, which is also the key point in this project of how to control the strength of each hit at the ball. The larger the velocity of the controller, the harder the ball is hit.

Some other features that I implemented using GUI are changing theme color and modifying the amount of balloons on screen. Being able to adjust the number of balloons basically means if you think the game is a little hard and you can’t seem to hit the balloons, you can increase the chance of hitting them by increasing the number of them.

Aesthetics   I mapped the color of the balloons to their position, so that all the colors looked harmonious together. I added a little triangle at the bottom of each balloon so that they looked more like balloons. For the fireworks, they start out in the same color as the popped balloon, but as they fall they get redder-ish / yellower-ish. The appearance of the controller echos that of the ball. I added a half-transparent layer on top of the actual object, so that even if the player changes their color to black, which is the background color, they’re still visible.

Presentation  Also, I wanted to defend myself that this game is far less hard to play than it looked during presentation! Because of some weird setting of my laptop, when things were projected on the screen, the canvas got larger but objects remained small. I think it was because I used pixels to scale them. Below is a video clip of me playing with it – not hard at all, right? You can try it yourself 🙂

NOC – Midterm Project – Keyin Wu (Quoey)

The Story of A Tree

Introduction

This project basically simulates the process of a tree’s growth throughout the year. I use some abstract shapes as well as some realistic outlines to present this tree by p5. It involves a lot of different objects, like green leaves, yellow leaves, flowers, fruits and some environmental elements. For the final video demo, I also add the background music to make this project more complete and strengthen the user experience.

Process

First of all, I sketched the timeline of different objects and movements. I decided to create the scenes one by one and finally combine them all together. And there are five periods in total.

  • Spring: The Season of Growing

In this period, the tree and leaves start to grow. I created two kinds of leaves in order to enrich the scene, and the two kinds of leaves will also disappear in different ways later.

  • Summer: The Season of Blooming

In this period, there will be flowers popping up, scaling in some frequency related to noise value. And the flower is consisted of several transparent long ellipses and a circle in the middle. 

  • Autumn: The Season of Bearing

This season has most transformations. Flowers turn into fruits and the majority of green leaves will shake and then “explode” out of the canvas. The remaining little leaves, as well as new leaves turn up later, gradually grow yellow. In the end, the fruits fall down the tree.

  • Winter: The Season of Withering

In this period, yellow leaves fade away slowly. The whole scene gets darker as if the cold winter is approaching. 

  • Recovering and Regrowing

With some white particles falling into the scene, the scene will get brighter. Those white particles can be imagined as either snow flakes or simply some light, which represent the signal of recovering. Therefore, after the white particles fall, there will be a couple of new green leaves popping up on the branches, and that’s just another round of story.

As for the debugMode, I mostly used it to check the outlines and the movements of my objects. Since I have different objects in different periods, I tried to keep it simple and obvious. I also added the variable of array length to the controller so that the user can manipulate the number of objects in real-time. I think debugMode tool is really useful and I would like to spend more time on how to combine it with my project better.

Demo

For a better experience, I added background music to my demo. To clarify, I did not make any change to my original recording of my project. I just adjusted the music a little bit to make it fit my project better.

The user can feel the music changes with the scene. Specially in the recovering period, I also added some birds’ singing. And here is the demo.

*BGM: EpicMusicVn – Last Reunion

Further Development

  1. Firstly, I think there can be more vivid creatures like little animals or insects playing with the tree. In fact, I tried to implement another creature class, but the result was not so coherent with my whole project and I did not use them in the end. However, I would like to spend more time on this part in future.
  2. Secondly, since I want to focus on what we learned in the first half semester like vectors, forces and oscillations, I did not spend too much time on the recursive tree. For now, the branches just move in the same way all the time and I think there can be more variations.
  3. Lastly, I think there can be some interaction between each object as well. And they can all interact with the branches in some way.

NOC: Midterm Project – Katie Pellegrino

Nature of Code: Midterm Project

Stargazer by Katie Pellegrino
Introduction:

The goal of my project was to explore creating a visually pleasing and interactive night sky display. Living in the middle of such a large city, it’s sometimes hard to find stars in the night sky, yet,  I think they’re one of the most beautiful things to gaze upon. Additionally, I think there’s a lot of power in the stories and oral history that people save within constellations. Therefore, I thought it would be cool to create a project that allows the user to draw their own constellations and also enjoy a visual display of an array of constantly redrawing constellations across a night sky.

Inspiration:

In researching constellation/star projects, I was inspired mainly by two similar projects. The first is by Akshay L. Aradhya which I especially love for how it maps a peaceful and rather dream-like night-sky visual. The mouse interaction that scatters the stars and the way they continuously redraw new constellations and star connections is beautiful and pleasing.

The second is a project by Diego Garcia. Similarly, it draws connections between stars based on their distance from each other. However, it allows the user to place the points, which afterwards, continuously are mutually attracted to each other using gravitational attraction. I really like how the user can initially place the points within the sketch.

General Mechanics / Assets:

My commented code can be found here for a contextual explanation.

Overall, my code is organized using various functions within the main sketch along with a ‘Star’ class for determining the star movement and procedure.

The main general mechanics is the star movement and oscillation. The oscillation is created with a simple adjustment to their radius as determined by a sinValue. When each star is created I assign them a random frequency which is multiplied by the frameCount, therefore, each star ‘sparkles’ at a different rate. Additionally, the stars are programmed to float around the screen with random acceleration between -0.5 and 0.5. There’s no gravity or attraction in their floating movement to create a sense of them drifting through space.

Initial Constellation State (static):

When the program first starts, it is in the static state which allows the user to draw a constellation by clicking on the screen. Every time this state is initiated, a ‘star’ array is emptied and each time the user clicks on the screen a new star point is drawn and added to the array. Additionally, each star point is connected through a connectConstellation function. Essentially, it filters through each star in the array and compares it to the one next to it and draws a line between the two.

Stargazing State (dynamic):

When the stargazing state is initiated (when the user presses ‘enter’ while in the static state), the stars saved in the temporary ‘star’ array are pushed to a constellation array. Basically, this array stores each constellation as an array of stars so that when the user returns to the static state, the constellations can be redrawn. 

Additionally, the stars are given an initial random acceleration to disperse them. I see a parallel between drawing a constellation in the sky and sending it out to the universe to live. At this point, the stars drift on their own, however, whenever they are within 100 pixels of another star they draw a line. Thus, each star that the user adds to the screen then can explore and ‘mingle’ with other stars on the screen in an ever changing connection. 

This operation, in theory, was quite simple. Just use a nested for loop to compare each star to each other star and, if they’re within a certain distance of the other, draw a line. However, while this works with a few stars on the screen, once there are a large number of stars on the screen, the complexity is too huge and the program is nearly unreadable because it is so slow.

To avoid this, I employed a regions structure which essentially creates a multidimensional array that grids the screen into 100×100 squares. For each frame of code, this array is reset and each star checks its location and is placed within a section of the array.

Therefore, when the star is checking the stars around it to see whether it should draw a line, the for loop only references the stars within each individual star’s region and the regions surrounding it.

While this process seems more complicated in the code as the regions array is updated and changing in every frame, it significantly lowers the complexity of code because the star is only concerned with stars that are within relative distance to it.

Additionally, in this mode the stars repel the mouse position. To avoid the stars accelerating too much, if their velocity is above a certain threshold, friction is applied.

Returning Constellation State (static):

When the sketch returns to the static mode (when ‘space’ is pressed while in the dynamic mode), the stars are attracted to their original location (stored in each object). Additionally, the sketch checks for when the star’s current position is within 2 pixels of its original location and, if this is true and is true for the star next to it within its array, a line is drawn between them. Thus, each constellation is gradually redrawn. 

Additionally, the temporary ‘star’ array from the start is reset so the user can draw another constellation that remains separate from the others. Again, once the user returns to dynamic mode, this array is pushed to the constellations array and saved as a new constellation.

Finally, as a final touch, I added some background music to set the tone. It took some browsing to find the correct feel, but my goal was celestial, mystical, mysterious, and fulfilling. Additionally, I added a swoosh sound effect to add emphasis for when the constellations are dispersed into the sky during the transition from static to dynamic mode along with a twinkling sound for when the stars regather from dynamic mode to static mode. Also, I added a bell ding for when each star is initially drawn/placed on the screen. All of the audio was downloaded from Zapsplat with normal usage license. Unfortunately, some of the sounds weren’t exactly as I’d envisioned them, however, I think they managed for the sketch.

Debug Mode:

My debugMode for the sketch is rather simple. It allows the user to adjust the parameters for drawing a star. The ‘grow’ adjusts the frequency of the star’s pulse while the ‘amp’ adjusts how much the star fluctuates. These are most effective in static mode, however, an issue that arises is that whenever the user adjusts the parameters, they must click on the screen and, thus, draw an unintentional star. 

However, while debug mode needs a little adjustment to function smoothly in static mode, in dynamic mode the user can adjust ‘regDist’ which changes the range of the regions. Thus, the bigger the number, the farther the star’s reach and the more other stars it will connect to. This is a simple adjustment, but can dramatically change the feel of dynamic mode.

Finally, when the user enters debug mode, it reveals the outline of the stars which better clarifies their rate and size of oscillation. Something I’d like to add in the future is a line that shows each stars acceleration within dynamic mode, however, for now the debug mode is quite straight forward.

Challenges:

The biggest challenges that I faced in this project was organizing the regions data structure and, overall, conceptualizing which code should be organized as a method within the class and which should be a function within the main sketch. Overcoming these challenges is explained in greater detail above, but, overall, through this project I gained a much better understanding and appreciation for the possibilities of code both in terms of logic, complexity, and clarity.

Improvements:

Among the many improvements I’d like to make with this project, I think the most significant are dealing with the audio and the interface. A feedback advise that I got from our presentation was to add modulation to the ding associated with placing the stars. I’d like to do this because currently the clink is rather bland and just slight modulation might add some more ‘spark’ to the stars. Additionally, currently the ‘twinkle’ effect associated with the stars returning to their initial constellation isn’t connected to the length of time that it takes for the stars to return home. So I think it’d be cleaner if it was related somehow.

Additionally, in terms of the interface, I’d like to somehow make it more user friendly. As of right now, you click to add stars, press enter to save the constellation and switch to dynamic mode, then press space to switch back to static mode. However, while these controls are pretty straight forward, there’s nothing explaining them. I’d like to make it more user-friendly, but also don’t want to lose the clean full screen display aspect of the presentation. So figuring out the best of both worlds would be ideal.

Finally, another suggestion that I received during the presentation was to allow the user to determine how big a star might be based on how long they click to place it. I really like this because it gives the user more control over the stars they create and allows them to better personalize the night sky.

Concepts / Explorations:

For this project, I explored a lot with using states or modes that dictate when the objects should react in a certain way. Additionally, using multidimensional arrays was essential both for organizing the screen into regions and in saving the constellations. Finally, I became much more comfortable with applying force and manipulating objects through oscillation. 

Final Remarks:

Overall, this project was super interesting to complete and I feel like it accomplished the mood that I set out to create. I had a lot of help on this project to which I am extremely thankful and learned a lot through the process. While there are certainly a variety of improvements and ways of further expanding this project, I’m very satisfied with the outcome and am all the more amazed by the possibilities of coding animations.