Final Project – Sidrat al Muntaha

Idea

Sidrat Al-Muntaha | artnexploration

Sidrat al-Muntaha (Lote Tree) is the farthest boundary in the seventh heaven which no one can pass. It is called Sidrat al-Muntaha because the knowledge of the angels stops at that point, and no one has gone beyond it except the final prophet and messenger of Allah, Muhammad ﷺ. It is mentioned both in Quran and in Hadith when prophet Muhammad ﷺ was invited by Allah SWT for a visit known as Isra and Mi’raj.

I decided to make my final assignment a personal rendition of this scene, the boundary between heaven and Earth, home to a the colossal tree; Sidrat al-Muntaha.

Process

*********************************************************

  • Open sketches in new tabs for proper code executions
  • After clicking execute will take a few seconds to initiate ml5 library, user will get confirmation message in serial once ready and working.

*********************************************************

Iterations 1

Give the code a few seconds to start going, it takes a while for the ml5 library to come to action. You will get a message printed when it is ready, and you can raise your hand and see it reflected on p5.js.

I brought handposenet into my WEBGL canvas sketch and got it to work well on a small sqaure canvas (eg 500×500). I was able to extract the specific data points I need for the future iterations. The extracted data point is a different color from the others displayed.

I added a point matrix in the center to better understand properties of WEBGL canvas. I did not plan on keeping it to the end, but I am glad I did. It populates the empty canvas without impeding the grand, unsettling, awe atmosphere I am going for.

Iterations 2

In this iterations I worked on  created a 3D fractal tree. I extracted the specific data points I need from the handposenet library and feed it into the branch function. This way we can control the fractal growth of the tree my panning our hand in front of the webcam, horizontally.

Iterations 3

Here I added music and smoothed out tiny changes to make the code more efficient and capable of running on full screen.

Iterations 4

A Maurer rose can be described as a closed route in the polar plane. A walker starts a journey from the origin, (0, 0), and walks along a line to the point (sin(nd), d). These equations are the math behind my portal.

Code Snippets

function drawKeypoints() {
  for (let i = 0; i < predictions.length; i += 1) {
    const prediction = predictions[i];
    for (let j = 0; j < prediction.landmarks.length; j += 1) {
      const keypoint = prediction.landmarks[j];
      fill(0, 255, 0);
      if(i==0 && j==5){
        fill(255, 0, 0);
         }
      noStroke();
      ellipse(keypoint[0], keypoint[1], 10, 10);
    }
    
    handX = predictions[0].landmarks[5][0];
    handY = predictions[0].landmarks[5][1];
  }
}

The code works in conjunction with a machine learning model (PoseNet) that detects and provides information about human poses. The predictions array is assumed to contain information about these poses, and the nested loops iterate through each pose and its keypoints. The ellipses are then drawn on the canvas based on the x and y coordinates of each keypoint, with special handling for a specific keypoint (index 5 of the first pose).

function branch(len){
  strokeWeight(map(len,10,100,1,10));
  
  
  
  let glowColor = color(255, 255, 255); // Set the glow color

   ambientMaterial(glowColor); // Set the ambient material for the glow
  
  

  stroke(map(len,10,100,50,255));
  line(0,0,0,0,-len-2,0);
  
  translate(0,-len);
  
  let growth = map(handX,windowWidth-300,0+100,25,10);
  // let growth = 14
  
  if(len>growth){
    for (let i = 0; i<3; i++){
      rotateY(random(100,140));
      push();
      rotateZ(random(20,50));
      branch(len*0.7);
      pop();
      
    }
  }
}

The branch function draws a segment of a branching structure, adjusting stroke weight and color based on the segment’s length. It also includes a recursive branching logic, creating a visually interesting and dynamic branching pattern. The growth of the branches is influenced by the x-coordinate of a variable named handX.

for(let i = 0; i<361; i++){
    //mathematical formula for Maurer Rose
    let k = i*d;
    let r = sin(n*k)*500;
    let x = r*cos(k);
    let y = r*sin(k);
    vertex(x,y);
  }

The purpose of this code is to generate and draw a Maurer Rose, a mathematical pattern based on polar coordinates. The Maurer Rose is characterized by its elegant and symmetrical petal-like shapes.

The loop iterates through angles, and for each angle, it calculates the polar coordinates using a formula. These coordinates are then used to draw the shape.

The dynamic aspects of the pattern are introduced by incrementing the parameters n and d over time. This leads to a continuous change in the appearance of the Maurer Rose, creating an animated effect.

In summary, this code produces a visually interesting and dynamic pattern known as a Maurer Rose using mathematical formulas for polar coordinates. The 3D translation and incrementing parameters contribute to the overall visual appeal and variation in the pattern.

IM SHOW Installation

Challenges

  1. The handposenet started acting finicky in WEBGL when the canvas sizes kept changing. The integration of hand pose detection using ml5.js introduces the challenge of synchronizing the detected coordinates with the 3D canvas. Ensuring accuracy and responsiveness in real-time adds complexity to the overall design.
  2. It was challenging to make objects glow the way I wanted, again I think it is because WEBGL treats those properties very differently.

Future Improvements

  1. Enhancing the accuracy of hand pose detection can be achieved through machine learning model fine-tuning or exploring advanced techniques, ensuring a more precise mapping of user gestures to the visual elements.
  2. Implementing an intuitive user interface could provide users with controls to manipulate parameters dynamically. This could include sliders or buttons to adjust variables such as tree growth, portal dynamics, and point matrix density.
  3. I want to add massive orbs revolving around point matrix to act as heaven and Earth.
  4. I want to make the Maurer Rose portal a 3D model as well, like the fractral tree.
  5. Exploring adaptive audio composition techniques, where the soundtrack evolves based on user interactions and the state of the artwork, would enhance the synergy between the visual and auditory elements.

 

Final Project Draft 2 – Rude Goldberg’s Machine

Inspiration

I want to use a wide range of mechanisms, like those below, in my final project.

Interaction

I want to use pose.net to control physical object in real life that affect the game, or even being able to knock over/pick up elements in the game.

Final Project draft 1 – Ecosystem simulation

My project aims to create an immersive and artistic simulation that explores the delicate balance of ecosystems through interactive user engagement. This Ecosystem Simulation will leverage the Matter.js physics engine to bring to life a visually stunning representation of nature where users can influence and observe the dynamics of a virtual ecosystem.

Objectives:

  1. Artistic Representation: Develop a visually appealing ecosystem with vibrant flora and fauna, utilizing the capabilities of Matter.js for realistic physics and animations. Each element in the ecosystem will be meticulously designed to convey a sense of interconnected beauty.
  2. Interactive User Engagement: Implement mouse interaction to allow users to influence the ecosystem. Users will have the ability to introduce new species, adjust environmental conditions, and observe the resulting impact on the ecosystem. This interactive element will serve as a metaphor for the symbiotic relationship between human actions and the natural world.
  3. Symbolic Narrative: Infuse the simulation with a symbolic narrative that explores broader themes such as environmental sustainability, biodiversity, and the consequences of human intervention. The changing dynamics within the ecosystem will reflect the consequences of user choices, fostering awareness and reflection.

Features:

  • Flora and Fauna: Diverse and visually captivating plant and animal life, each contributing to the ecosystem’s overall balance.
  • Realistic Physics: Matter.js will be employed to simulate realistic interactions between elements, including growth, predation, and environmental factors.
  • User Interaction: Mouse-driven interactions will allow users to introduce or remove species, manipulate environmental variables, and observe the evolving ecosystem.

Target Audience: The Artistic Ecosystem Simulation is designed for audiences interested in the intersection of art, technology, and environmental awareness. It caters to individuals who appreciate immersive experiences that provoke thoughtful contemplation about our relationship with nature.

Outcomes: The project aims to deliver an engaging and thought-provoking simulation that not only showcases the aesthetic potential of Matter.js but also serves as a platform for reflection on ecological themes. By providing users with an interactive canvas to explore, we hope to foster a deeper understanding of the intricate connections within ecosystems and the impact of human choices.

Through this project, we aspire to contribute to the growing discourse on the intersection of art and environmental consciousness while offering a unique and memorable interactive experience.

code assignment – week 11 – Tiny Critters

Inspired by the intricate patterns of microscopic life, this week, my latest sketch offers a visual interactive exploration of the cellular automata ecosystem.

Inspiration: Microscopic Organisms Under the Microscope

The project draws inspiration from the mesmerizing appearance of microscopic organisms observed under a microscope. The delicate dance of amoeba, the vibrant hues of microorganisms, and their ever-changing patterns became the driving force behind creating a dynamic simulation using the p5.js library.

The overarching theme revolves around simulating an artistic ecosystem where each cell represents a microscopic organism. The cells evolve based on a set of rules, creating visually appealing patterns reminiscent of the microscopic world. The color palette, cell shapes, and interactive features are carefully curated to capture the essence of this microscopic realm.

Iterations

Scroll on touchpad – First I set out to build the main interactions of the project. I wanted to mimic the motion of magnification do when using a microscope. To zoom in and out if the sample. I did this by controlling the size of cells using the scrolling on touchpads. This was it looks as if we are sliding through different magnification lenses on the microscopic, examining the microbes.

Mouse click – this restarts the sketch on every left click.

Color scheme and figure – Next I focused on making the appearances more like the microorganisms I am used to seeing. I created two versions.

Lastly I also played around with the rulesets. Below is one I found particularly interesting.

Technical Aspects: Bringing the Microscopic World to Life

Code Snippet: Cellular Automata Ruleset

function updateCellState(x, y, neighbors) {
  if (board[x][y].state == 1 && (neighbors < 2 || neighbors > 5)) {
    // Any live cell with fewer than 2 or more than 5 neighbors dies
    board[x][y].state = 0;
  } else if (board[x][y].state == 0 && neighbors == 3) {
    // Any dead cell with exactly 3 neighbors becomes alive
    board[x][y].state = 1;
  }
  // Otherwise, the cell state remains unchanged
}

This code snippet showcases the heart of the simulation – the ruleset governing the evolution of each cell. By adjusting these rules, we can create a myriad of fascinating patterns resembling the behaviors of microscopic life.

The updatecellstate() function encapsulates the logic, taking into account the current state of the cell, the number of neighbors, and applying the rules to simulate the dynamic evolution of the cellular automaton.

Challenges Faced: Iterative Refinement and Debugging

Throughout the development process, one of the main challenges was fine-tuning the ruleset to strike a balance between creating visually engaging patterns and ensuring interactive responsiveness. Debugging intricate interactions within the cellular automaton required iterative refinement and careful consideration of the aesthetic and thematic goals.

Future Improvements: Dynamic Interactivity and Realistic Simulation

As I look ahead, future improvements could include enhancing the interactive elements, such as introducing dynamic user-controlled parameters or integrating more realistic simulations of microscopic behaviors. Exploring optimizations for larger-scale simulations and incorporating additional visual elements would further enrich the immersive experience.

Coding assignment – week 10 Dominos + Newton’s cradle

This week I really enjoyed using matter.js. Working with object and not have to worry about the physics felt intuitive. I made two seperate sketches to show.

Dominos

I’ve always loved watching Rube Goldberg machine videos and I aimed at making a very simplistic version for this project using what we learnt in class.

Rube Goldberg Machine > Experiment 16 from Physics Explorations and Projects

My aim was to continuously transfer the kinetic energy from the initial pendulum swing to the row of dominos. This is just the start, which I hopefully will build on to create a more complex system. I gained greater understanding of the matter.js through this.

Challenges

A lot of trial and error was required to get all objects moving like intended, especially since they don’t start off with the physical properties I envisioned.

Newton’s Cradle

How Newton's Cradles Work | HowStuffWorks

For this sketch I set out to create a Newton’s cradle using matter.js. While I am content with the result, I realize that it isn’t very realistic. The motion in my sketch is slightly off. I initially thought just placing the pendulums side by side would be enough to simulate this phenomena but I later learnt that I had to tweak its physical properties quite a lot to get the right motion. This makes sense in hindsight since we can’t just make Newton cradles out of any material in real life.

Lecture relfection

In his talk, Neil Leach spoke about the rise of AI prevalence in the last 100 ears, with emphasis on the rapid, borderline uncontrollable, rate of research and breakthroughs being put out. What stood out to me the most was his fear surrounding the lack of concern for safety measures in the field. I too share his sentiments, as I’ve always been interested in AI safety, particularly AI Governance, which is the establishment of policies, regulations, and ethical frameworks to guide the development, deployment, and use of AI. Governments need technical personal that are savvy in this new field in order to establish fair laws in ‘wild west’ era of AI research. We need regulations, just like any other aspects of society are regulated to maintain order. Some objectives would be to establish ethical principles, ensure transparency, protecting data privacy, maintaining security, and establishing accountability.

Code assignment – week 8 – Bug Spray

In this sketch, I created an interactive simulation where a bug spray chases a cockroach on the screen. The bug spray employs steering behaviors to follow the cockroach, and when the cockroach is within a close proximity, the bug spray visually simulates spraying.

Challenge

One challenge encountered was ensuring smooth steering behavior for the bug spray. Tweaking parameters such as maximum speed, maximum force, and the radius for arrival behavior required careful adjustment to achieve a natural-looking pursuit.

Code Snippet

push();
    translate(this.pos.x, this.pos.y);
    rotate(this.vel.heading());
    noStroke();
    fill(0, 200, 0); // Color for bug spray
    rect(-8, -25, 16, 50); // Bug spray shape
    fill('yellow'); // Color for bug spray nozzle
    ellipse(0, -25, 16, 16); // Bug spray nozzle
    pop();

As seen in the above code, I used push and pop to make it simpler in creating the shapes for the code. I also used the rotate function to make the orientation of the bug spray to correspond to to the cockroach position.

Future Improvements

  1. Particle System: Enhance the spraying effect by adding a particle system to visually represent the spray dispersing.
  2. Obstacle Avoidance: Implement obstacle avoidance behaviors to make the bug spray navigate around obstacles on the canvas.

Midterm Project – Tron Terrain

https://editor.p5js.org/as13805/full/ZG70leVbF

The sketch appears to draw inspiration from the iconic sci-fi movie, Tron. Tron, released in 1982, is known for its distinctive visual style characterized by neon-colored, grid-like landscapes and futuristic aesthetics. The sketch’s terrain generation with lines and triangles resembling a digital grid resonates with the world inside Tron’s computer system. The use of a dark, black background, along with the bright, neon-like stars and the red attractors, strongly evokes the movie’s signature color scheme. This is meant to instill nostalgia in the movie’s viewers.

Tron aesthetic:

Futuristic Wallpaper 4K, Hallway, Neon Lights, Glowing, 5K

The code is organized to create a visually appealing 3D scene with a grid-like terrain, moving stars, and potentially moving attractors. The use of Perlin noise for terrain generation adds a dynamic and abstract element to the sketch. Object-oriented programming is employed to encapsulate and manage different elements, making the code more structured and readable.

Screengrab:


Hand Sketch

Pen Plotter sketch

Since this sketch uses webGL I could not use the SVG export code. Hence I resorted to a screenshot which i converted to SVG in inskscape. I made two changes in order to accommodate for the plotter format. First I reduced the number of rows and columns which effectively reduced the vertices of the sketch and in turn lowered the complexity. I also increased the x.off and y.off values which made the terrain more turbulent. This was to compensate aesthetically for the lower vertex count.

Pen Plotter timelapse:

Future improvements:

I want to make the experience more immersive by allowing the sure to control the camera angles, thereby letting them traverse the terrain on their own at any POV.

I also want to apply textures to the terrain. Instead of a plain grid, I can use textures to make it look like an alien landscape, a digital city, or any other thematic environment.

I also learnt a lot from the video below:

https://youtu.be/_Tyhfpxwips

Midterm progress 2 – week 6

I began working on creating a dynamic, 3D terrain that continuously morphs over time. I used WebGL for 3D rendering.

let terrain;
let cols, rows;
let w = 20;
let flying = 0;

function setup() {
  createCanvas(windowWidth, windowHeight, WEBGL);
  cols = floor(width / w);
  rows = floor(height / w);
  terrain = new Terrain(cols, rows);

  // Set the camera position and orientation
  let camX = width / 2;
  let camY = height / 2; // Adjust this value for the desired side view
  let camZ = (height / 2) / tan(PI / 6); // Adjust this value for the desired zoom
  camera(camX, camY, camZ, 0, 0, 0, 0, 1, 0);
}

function draw() {
  background(0);

  // Center the sketch on the canvas
  translate(-width / 2, -height / 2);

  terrain.update();
  terrain.display();
  flying -= 0.05;
}

class Terrain {
  constructor(cols, rows) {
    this.cols = cols;
    this.rows = rows;
    this.w = w;
    this.terrain = [];
  }

  update() {
    let yoff = flying;
    for (let y = 0; y < this.rows; y++) {
      let xoff = 0;
      this.terrain[y] = [];
      for (let x = 0; x < this.cols; x++) {
        this.terrain[y][x] = map(noise(xoff, yoff), 0, 1, -100, 100);
        xoff += 0.2;
      }
      yoff += 0.2;
    }
  }

  display() {
    stroke(255);
    noFill();

    for (let y = 0; y < this.rows - 1; y++) {
      beginShape(TRIANGLE_STRIP);
      for (let x = 0; x < this.cols; x++) {
        vertex(x * this.w, y * this.w, this.terrain[y][x]);
        vertex(x * this.w, (y + 1) * this.w, this.terrain[y + 1][x]);
      }
      endShape();
    }
  }
}

 

The Terrain class is the core of our terrain generation. It contains methods for updating and displaying the terrain. I want to work on making it aesthetic itself more blocky, since my inspiration for this project is minecraft and I want to replicate its look. I also want to change the colors of the lines depending on their depth, so I can represent land and water.

Midterm progress – week 5

This week I spend most of my time looking for inspiration. I wasn’t particularly set on anything specific to work on or build. And in searching for unque projects online, regardless of whether they were made on p5.js or not, I felt they either, fell short of what I wanted, or where too ambitious to pursue in the timeframe we have.

Out of exhaustion, I reeled back to things from my childhood I vividly remember. Cartoons, parks, toys, video games. That was it. I want to recreate something from my childhood, specifally minecraft terrain. While I didn’t play it much myself, I used to watch countless hours of ‘Let’s plays’ content on youtube. I’d get completely invested in the world, stories and people.

Minecraft's world generation and monster spawns are changing completely |  PCGamesN

In p5.js I want to recreate the minecraft terrain that evolves with time. Like the everchanging world in real time, my world will also grow and shrink as the code keeps running. I want the user to be able to control the speed at which the terrain changes (by controlling time in this world). I also want to make different, worlds that the user can choose to run and control.

To make the terrain trasnformation as natural as possible, I will have to study erosion in the real world, and find out how to implement it in p5.js using perlin noise. If I have enough time, I also want to learn to make the transformations audio reaactive. I will need to familarize myself the sound libraries in order to do this.

I will learn terrain generation form the below video.