Final Presentation: Feedback

DSC_0351

Of the feedback I received (both in final presentation, and from peers) it was obvious that the main intrigue was the projects potential to be taken further. How could this workflow be applied to a greater context. As mentioned, it was my original intention to use this system to ‘break’ a room or other real world geometry using projection mapping (however it was not suitable in the time frame of this paper). The He.selection function could be used to select specific geometry. To complete this phase I will do some quick visualizations of what this may look like had I got them working.

Unfortunately during the presentation the processing sketch crashed more quickly than it usually does. My guess is a more powerful Arduino Mega would solve this problem.

DSC_0350


Development of Concept:

Manipulation of a internal spaces geometry. During presentation we talked about the option of moth movement with ones hand or entire body. While I like just ones hand for the sphere, using an entire room as below would be more emersive tracking ones body.

4864876

Alternatively the concept could be developed to be projected onto a spherical surface, bringing my code even further into the third dimension. Cheeky Civic Square example below.

9831

Advertisements

Week 12: Sound and Minim

Tutorials and Forums Used:

http://funprogramming.org/99-Add-sounds-to-your-programs.html

https://processing.org/discourse/beta/num_1224778221.html

Using the fun programming tutorial above as well as the examples found in Minim I was able to add an atmospheric soundtrack to the sketch. While I considered adding trigger sounds I thought the most powerful gesture would be just to change the volume the bigger the sphere grew. I added the following lines of code to my sketch to achieve this. We’ll just have to believe me that it worked.

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
Minim minim; //minum sound
AudioPlayer click;
void setup() {

 minim = new Minim(this); //minum
 click = minim.loadFile( "02 I Saw A Ray.mp3",2048);
 click.loop(); // loop background music
 click.setGain(-30.0); //volume base level
}
void draw(){
click.setGain(((-y)+350)/35); //volume change minim
}

Soundtrack used: (track begins at 2.30.

Week 12: Colour (or not)

I attempted to manipulate the code so that it would colour all the individual faces differently. I was able to get it to colour the sphere ‘mesh’ but not the ‘meshcopy’ which is actually the bit that moves as the sphere breaks. Unfortunately processing crashed and i lost the sketch so I have not even got a screen shot of that. I have not been able to get it working since. The code involved make a He_Selection of the faces and then re-colouring them as seen in one of my early experimentations with He_Mesh.

Week 12: Wireframe

As mentioned in the annotation of the code in the previous post I added the option for the mesh to be rendered in wire frame. The appearance is beautiful however is not as dynamic and the solid render.

Week 12: Resolved Sketch

The resolved processing sketch is outlined below. I have annotated it well so it can be followed. Important information is highlighted in blue. I am unable to post this to open processing for to reasons;  it contains librarys and more importantly the version of Processing 3.0 that I used is not compatible with the javascript plugin. I will document the sketch working in final presentation.

import wblut.math.*;
import wblut.processing.*;
import wblut.core.*;
import wblut.hemesh.*;
import wblut.geom.*;
import processing.serial.*;
HE_Mesh mesh, copymesh; //mesh is the sphere, copymesh is when it is 'broken'
WB_Render render;
int baud = 14400; //baud set, make sure is the same as arduino
int lf = 10; // linefeed in ASCII
String myString = null;
Serial myPort; // serial port that is being used
float num;
//easing
float y;
float easing = 0.01; // speed at which the mesh returns to a sphere, higher is faster
//rotation, left as three values for if needs to be chnged later
float a = 0.0;
float b = 0.0;
float c = 0.0;
void setup() {
 
 //fullScreen(OPENGL); // screen fill window
 size(800, 800, OPENGL); //for testing
 surface.setResizable(true); //fits the window to the screen size
 noCursor(); //hides the cursor when it is over the window
myPort = new Serial(this, Serial.list()[0], baud); //port number [0] and baud rate set
 myPort.clear(); 
 
 HEC_Sphere creator=new HEC_Sphere(); // sphere created
 creator.setRadius(100); //radius of sphere
 creator.setUFacets(64); //complexity of sphere
 creator.setVFacets(64);
 mesh=new HE_Mesh(creator); 
 HET_Diagnosis.validate(mesh);
 
 stroke(255,255,255); // stroke colour and weight if wireframe renderer is applicable
 strokeWeight(0.5);
 render=new WB_Render(this); //render!
}
void draw() {
 
 background(0,0,0,0); //background colour, set to all black as not to show on projector
 
 //light movement
 b += 0.001;
 c = sin(b)*5; // sin causes swing effect is light movement
directionalLight(255, 255, 255, c, c, -1); // all white light, movement on x and y axises
 //directionalLight(127, 127, 127, 1, -1, 1); // secondary light
 translate(width/2,height/2, 0); //light centred to window
 
 //rotation of mesh
 a += 0.001; // rotation speed
 if(a > TWO_PI) { //two pi indicates a full rotaion
 a = 0.0; //return to zero after completing a rotation
 }
 
 //readings sent from arduino from sensor
 while (myPort.available() > 0) {
 myString = myPort.readStringUntil(lf);
 if (myString != null) {
 print(myString); // prints string
 num=float(myString); // converts and prints float
 println(num); 
 }
 }
 myPort.clear();
 
 rotateY(a); //option to rotate starting position of mesh
 rotateX(-a);
 HEM_Noise modifier=new HEM_Noise(); // noise modifier causes breaking effect
 copymesh=mesh.get(); //mesh copied from sphere
float targetY = ((num-10)*4);
 float dy = targetY - y; //easing applied
 y += dy * easing;
 modifier.setDistance(constrain((-y)+350,0,350)); // min/max distance set for sensor in relation to sphere size
 //values reversed by (-y)+350
 modifier.setSeed(100);
 copymesh.modify(modifier);
 
 //HEM_Wireframe wireframe=new HEM_Wireframe(); // option to apply wireframe render
 //appearance
 fill(255); //mesh white, i don't like colour ;)
 noStroke(); // stroke removed
 render.drawFaces(copymesh);
 //render.drawEdges(copymesh); // for wireframe
 
 /* println(mouseY);
 delay(100); */
}

Week 12: Stylistic Changes

I added some subtle changes to the sketch including a slow rotation as well as a lighting that slowly shifts as if to mimic phases of the moon. The following section of sketch makes us of ‘+=’ to cause a constant increase in value till it is interupted by an ‘if’ function. Addtionally using ‘sin’ allows the lighting to swing from one side to the other.

//LIGHT ROTATION
 b += 0.001;
 c = sin(b)*5;
directionalLight(255, 255, 255, c, c, -1);
 //directionalLight(127, 127, 127, 1, -1, 1);
 translate(width/2,height/2, 0);
 
 //ROTATION
 a += 0.001;
 if(a > TWO_PI) { 
 a = 0.0; 
 }

Week 11: “Delay and Baud”

The sketch is still somewhat jumpy and unpredictable even with easing applied. the first change I made was to remove the ‘delay(100);’ from the Arduino sketch(I had forgotten it was there). This helped somewhat, however the real trick was increasing the baud rate. The frequency of interaction between Arduino and Processing. At 9600 it is currently too slow, of which is causing the stutter. 14400 seems to be the sweet spot, anything higher crashes processing. Occasionally at 14400 processing will not start, but restarting solves the problem. This is not entirely stable but suitable for this application. I have added the following making it easy to change later:

Processing:

int baud = 14400;
myPort = new Serial(this, Serial.list()[0], baud);

Arduino:

const int baud = 14400;
 Serial.begin(baud);

Week 11: Easing and Constrain

“Easing” is a function in processing which essentially smooths between a number of given values, essentially removing any ‘jerkiness’. i made use of the easing example sketch in processing to get this to work. The easing is defined by the lines;

//EASING
float y;
float easing = 0.01;

Later in the sketch use the following to apply the easing to the values received from the Arduino. Not here I have also made use of ‘constrain’ to set maximum and minimum values so that the sphere stays within the screen. Going beyond the screens edge ruins the illusion of the projection.

 float targetY = ((num-10)*4);
 float dy = targetY - y;
 y += dy * easing;
 modifier.setDistance(constrain((-y)+350,0,350)); // min/max distance set for
 modifier.setSeed(100);
 copymesh.modify(modifier);

I have used -y+350 so that the sensor values are reversed. In practice this means that , when someone is close to the sensor the sphere will be larger rather than smaller. Essentially 340/350 becomes 10/350, 100/350 becomes 250/350 etc. The value 350 would have to be changed if the screen size changes.

Screenshot (43)