INto the STARS and back
A SPACE EXPLORATION USING PROCESSING, VISUALISING COSMIC OBJECT WITH A DIGITAL LANGUAGE
Course Title: SHAPES AND ALGORITHMS: COMPUTATIONAL TOOLS FOR GENERATIVE DESIGN
Program: Processing Professor: Anna Scotti
Year: July2023-Feb2024
University: Politecnico di Milano
Indiviual Project
1
02/02/2024
JANE.ZHUOAN DAI
2 //
CONTENT
PROJect Breakdown
P-4 WHATS NEXT? P-1 Concept P-2 Experiments P-3
Programnning language Space Exploration User Interaction
3 P-1
+ + = ?
Concept EXPLORATION
PROGRAM EXPLORATION
Pixalizating Stars/Galaxies
MAIN FUNCATIONS IN USE:
_PShape
_Pixalization
_P3D
Inspired by timrodenbroeker
4 IN TO THE GALAXY AND BACK
P-2
[
]
A
PROGRAM EXPLORATION
Recreating the planetray system
MAIN FUNCATIONS IN USE:
_P3D,
_TEXTURE,
_CAMERA MOVEMENT,
_LIGHTING
Inspired by timrodenbroeker
5 IN TO THE GALAXY AND BACK
P-2
[ B ]
THE PROJECT STAR FINDER
Project Goal: __01 Viusalzation
__02 Responsiveness
__03 Interactivity
6 P-3
+ AN INTERGALAXY TRAVEL SIMULATION [ 2049 ]
PROGRAM
JAMES WEBB SPACE
TELESCOPE -- NASA
VISUAL SCAPE
ASTRONOMY PICTURE OF THE DAY (APOD) -- NASA
VIDEO CAPTURE (USER)
INTERNET API
STEREO WHITE NOISE
SOUND SCAPE
SOUND EFFECTS
SOUND TRACK
AUDIO INPUT (USER)
LOCAL DATA
KEYBOARD CONTROL
MOUSE CONTROL
MOUSE REACTION
USER GENERATED
SOUND REACTION
7 IN TO THE GALAXY AND BACK // 01
OVERVIEW INTERGALAXY TRAVEL_ STAR FINDING SIMULATION
INTERACTION + + + +
[
LET US DEPART! ]
Interface & Code Breakdown
Chapter
[ Part 1_ Departure ]
[ Part 2_ Explore ]
[ Part 3_ Souvenir ]
User Experience:
--> Unique Star Finder Operator Number
--> Observe travel to different galaxies
--> Detacting the stars
--> Enjoy some space music
--> Take a pictures in the galaxy
9 IN TO THE GALAXY AND BACK // 02
INTERGALAXY TRAVEL_ STAR FINDING SIMULATION
2.0.1
Defining
import processing.sound.*; import processing.video.*; import ddf.minim.*; import gifAnimation.*;
PImage[] images = new PImage[12]; PImage sp1; PImage apod; PGraphics sh1; PGraphics g1; PGraphics U; Gif gif; PShape icon1; PFont font; PFont title;
//for Text
float ts = 80; //title size
String code = str(int(random(1000,9999)));
char L1 = char(int(random(65, 91)));
char L2 = char(int(random(65, 91)));
char L3 = char(int(random(65, 91))); int TD = day();
int TM = month();
int TY = year();
String date = TD + “/” + TM + “/”; String[] nameG = {
“Star Cluster Westerlund2”, “Galaxy NGC3256”, “Stephans Quintet”, “Globular Cluster NGC6544”, “Supernova Remnant CassiopeiaA”, “Galaxy NGC6951”, “NGC247 / The Needles Eye”, “Hickson Compact Group31”, “NGC7814 / Caldwell43”, “Galaxy NGC685”, “Galaxy Cluster Abell370”, “NGC4826 / Evil Eye”, “NASA APOD” }; String name;
//for Sounds Minim minim; AudioPlayer intro; AudioPlayer UI_1; AudioPlayer UI_2; AudioPlayer UI_3; AudioPlayer song; SinOsc SWave; WhiteNoise noise; LowPass lowPass; AudioInput in; boolean isPlaying = false; int startFrame = 770;
//for Color color[] cols = {#FFEEC5,#DAB2FF,#C8FFF3,#0000FF, #E0B0D5,#8400FF,#00FFF7,#0088FF,#FFB300}; float margin = 0; Agent[] agents = new Agent[1200];
//for Video Capture video;
10 IN TO THE GALAXY AND BACK
//
SETUP()
void setup() { size(800, 800);
font = createFont(“IBMPlexMono-Bold.otf”, 100);
title = createFont(“Gries.otf”, 100);
for (int i = 0; i < images.length; i++) { images[i] = loadImage((i+1) + “.jpg”); images[i].resize(height+100,height+100);
NasaImage(); sp1=images[0];
gif = new Gif(this, “earth1.gif”); gif.play();
sh1 = createGraphics(height,height);
U = createGraphics(width,height);
icon1 = loadShape(“vinyl.svg”);
for (int i=0; i<agents.length;i++) { agents[i] = new Agent();
minim = new Minim(this);
intro = minim.loadFile(“Spaceship Takeoff Sound. mp3”);
intro.play();
UI_1 = minim.loadFile(“UI_1.mp3”);
UI_2 = minim.loadFile(“UI_2.mp3”);
UI_3 = minim.loadFile(“UI_3.mp3”);
SWave = new SinOsc(this); noise = new WhiteNoise(this); lowPass = new LowPass(this);
song = minim.loadFile(“Alex Boychuk - Stellar Flow.mp3”); //song.play();
video = new Capture(this, width, height); in = minim.getLineIn(Minim.MONO, width, 44100, 16); }
// update frame
void captureEvent(Capture video) { video.read(); }
11 IN TO THE GALAXY AND BACK
}
}
// 2.0.2
2.1.1 INTRO_ Departure
void draw() { background(0); imageMode(CENTER); push(); if(frameCount<440){
image(gif, width/2, height/2, gif.width*3, gif.height*3); }else{
translate(0,(frameCount-440)*(frameCount-440)); image(gif, width/2, height/2, gif.width*3+(frameCount-440)*2, gif.height*3+(frameCount-440)*2); }
pop(); push();
noStroke(); fill(0,frameCount/3); rect(0,0,width,height); pop();
//particals noStroke(); for(Agent a : agents){ a.display(); a.update();
12 IN TO THE GALAXY AND BACK
} //
MAIN FUNCATIONS IN USE: _Display the Gif _Function 1/3
INTRO_ Departure
class Agent { float x,y; float r,t; float size; float ringN,ringS; color col; Agent(){ r = 0; t = random(TWO_PI); x = width/2 + cos(t)*r; y = height/2 + sin(t)*r; size = random(0.2,3); ringN = 0; ringS = 1; col = cols[(int)random(cols.length)]; }
void display(){ stroke(col); strokeWeight(size); point (x,y); }
void update(){ if (ringN<39){ ringN+=0.05; } else { ringN=80; } if (ringS<width*0.4){ ringS+=0.5; } else { ringS=width*0.4; } r= map(sin(t*ringN), -1,1,0,ringS); x = width/2 + sin(t)*r; y = height/2 + cos(t)*r; t+= random(0.0001,0.0003);
MAIN FUNCATIONS IN USE:
_Class [ inspired by @hbyhadeel ]
13 IN TO THE GALAXY AND BACK
} } 2/3 TAB 2 TEST FRAME //
2.1.2
Departure
//intro Title push(); noStroke(); fill(0,200-frameCount/2); rect(0,0,width,height); pop();
textFont(title); if (ts>30){ ts-=0.1; fill(cols[(int)random(cols.length)],frameCount/2-100); }else{ ts= 30; fill(255,frameCount/2-100); }
textSize(ts);
textAlign(CENTER, CENTER); text(“+ [ WELCOME TO STAR FINDER ] +”,width/2,height/2);
14 IN TO THE GALAXY AND BACK //
2.1.3 INTRO_
MAIN FUNCTIONS IN USE: _Display Text 3/3
HomePage
15 IN TO THE GALAXY AND BACK // 3.0
05
HomePage OVERVIEW
01
02
06
03
05
04 TARGETING
STAR DETECTOR
08 SOUND REACTOR
07 POSITION NAVIGATOR
03
16 IN TO THE GALAXY AND BACK
INSTRUCTIONS
YOUR STATUS
GALAXY BACKGROUND
RESPONSIVE DOTS
STAR ATOM INDICATOR
CD PLAYER
//
GALAXY PREVIEW
3.0
3.1.1
Display Background
if (frameCount > startFrame) { textFont(font); textSize(10); fill(255);
name = nameG[0];
//TABS FUNCTIONS destinations(); scope(); sound();
//Back IMAGES push();
float imgX = (map(mouseX,0,width,-50,50)); float imgY = (map(mouseY,0,height,-50,50)); image(sp1,width/2-imgX,height/2-imgY); pop();
void destinations(){
if (key == ‘1’){ sp1=images[0];
name = nameG[0];
} else if (key == ‘2’){ sp1=images[1];
name = nameG[1];
} else if (key == ‘3’){ sp1=images[2];
name = nameG[2];
} else if (key == ‘4’){
... }else if (key == ‘ù’){ sp1=apod; name = nameG[12];
if (keyPressed){ Counter =0;
refresh(); }
17 IN TO THE GALAXY AND BACK
}
}
//
MAIN FUNCTIONS IN USE: _image display _if conditions 1/2 TAB 3
3.1.1
Modify background
//YOU in frame float tileW = 10; float tileH = 10; float TILES_X = width/tileW; float TILES_Y =height/tileH;
video.start(); video.loadPixels(); U.beginDraw(); U.clear(); U.push(); for (int x = 0; x < TILES_X; x++) { for (int y = 0; y < TILES_Y; y++) { int px = int(x*tileW); int py = int(y*tileH); color cu = video.get(px,py); float dis = dist(px, py, mouseX, mouseY); float light = map(dis, 0, 250, 150, 0); float r = 255-constrain(red(cu)-light, 0, 255); float g = 255-constrain(green(cu)-light, 0, 255); float b = 255-constrain(blue(cu)-light, 0, 255); color cu2 = color(r, g, b); U.fill(cu2); U.noStroke(); U.push(); U.translate(tileW/2,tileH/2); float UB= map(brightness(cu),0,255,0,0.2); U.ellipse(px,py,tileW*UB*uV,tileH*UB*uV); U.pop(); } } U.pop(); U.endDraw(); push(); //translate(width/2-320,height/2-320); //scale(0.2); translate(width/2,height/2); image(U, 0, 0); pop(); MAIN
18 IN TO THE GALAXY AND BACK //
FUNCTIONS IN USE: _Jason API _tint image 2/2
3.1.2
Responsive
Live Video Overlay
//Your Voice float uV = map(in.mix.level(), 0, 1, 1, 30);
//YOU in frame float tileW = 10; float tileH = 10; float TILES_X = width/tileW; float TILES_Y =height/tileH; video.start(); video.loadPixels();
U.beginDraw(); U.clear(); U.push(); for (int x = 0; x < TILES_X; x++) { for (int y = 0; y < TILES_Y; y++) { int px = int(x*tileW); int py = int(y*tileH); color cu = video.get(px,py); float dis = dist(px, py, mouseX, mouseY); float light = map(dis, 0, 250, 150, 0); float r = 255-constrain(red(cu)-light, 0, 255); float g = 255-constrain(green(cu)-light, 0, 255); float b = 255-constrain(blue(cu)-light, 0, 255); color cu2 = color(r, g, b); U.fill(cu2); U.noStroke(); U.push(); U.translate(tileW/2,tileH/2); float UB= map(brightness(cu),0,255,0,0.2); U.ellipse(px,py,tileW*UB*uV,tileH*UB*uV); U.pop();
U.pop(); U.endDraw(); push(); //translate(width/2-320,height/2-320); //scale(0.2); translate(width/2,height/2); image(U, 0, 0); pop();
MAIN
19 IN TO THE GALAXY AND BACK //
} }
_Audio input _Video.get 1/1 TEST FRAME
FUNCTIONS IN USE:
DISPLAY GUI
//Image Display for (int i = 0; i < images.length; i++) { image(images[i],width/2-220+i*40,height-20,30,30); noFill(); strokeWeight(0.5); stroke(0); rect(width/2-220+i*40,height-20,30,30); }
//music icon push(); icon1.disableStyle(); noStroke(); fill(255,150); translate(130,height-30); shape(icon1, 0, 0, 20, 20); icon1.enableStyle(); pop();
void mousePressed() {
if (dist(mouseX, mouseY, 140,height-20) < 25) { if (!isPlaying) { song.rewind(); song.play(); isPlaying = true; } else { song.pause(); isPlaying = false; }
20 IN TO THE GALAXY AND BACK //
3.1.3
} } MAIN FUNCTIONS IN USE: _image display _if condition & mouse click 1/1 TAB 3
3.1.4
TARGETING
//wave strokeWeight(1); for(int i=0;i<100;i++){ stroke(0,250-i*2.5); if (key == ‘r’){ stroke(255,0,0,250-i*2.5);
} else if (key == ‘g’){ stroke(0,255,0,250-i*2.5); } else if (key == ‘b’){ stroke(0,0,255,250-i*2.5); }
push(); translate(mouseX,mouseY); rotate(radians(frameCount)*1.4-i*0.008); line(0,0,width,width); pop(); }
//scope int sx = mouseX-50; int sy = mouseY-50; int sw = 100; int sh = 100; int dx = mouseX-100; int dy = mouseY-100; int dw = 200; int dh = 200; if (key == ‘r’){ stroke(255,0,0);
} else if (key == ‘g’){ stroke(0,255,0);
} else if (key == ‘b’){ stroke(0,0,255); } else { stroke(255); } strokeWeight(2); line(mouseX,0,mouseX,height); line(0,mouseY,width,mouseY); copy(sp1,sx,sy,sw,sh,dx,dy,dw,dh); rectMode(CENTER);
21 IN TO THE GALAXY AND BACK
//
MAIN FUNCTIONS IN USE: _image display _if conditions 1/1
// Detecting Star UGI String Result; fill(0); strokeWeight(1); rect(mouseX-100,mouseY,100,20);
if (cb>210||cs>100){
Result = “POSITIVE”; noFill(); stroke(255); strokeWeight(3); stroke(255); ellipse(mouseX,mouseY,40,40); textAlign(CENTER, CENTER); fill(255);
text(“PLANET DETECTED”,mouseX-100,mouseY); textAlign(LEFT, BOTTOM); fill(0,255,0); text(Result,55,height-10);
}else{
Result = “NEGATIVE”; fill(255);
textAlign(CENTER, CENTER); text(“UNKNOWN”,mouseX-100,mouseY); textAlign(LEFT, BOTTOM); fill(255,0,0); text(Result,55,height-10);
}
fill(255);
textAlign(LEFT, BOTTOM);
text(“DectectingStar.. \nResult:”,10,height-10);
22 IN TO THE GALAXY AND BACK
//
MAIN FUNCTIONS IN USE: _image display _if conditions 1/1
3.1.4 TARGETING
// TEXT
fill(255);
textAlign(LEFT, TOP);
text(“Mission: Star_Finding_101 \nOperator Code: “+L1+L2+L3+code +”\nDate: “+date+”2088”+”\nTime: “+ nf(hour(), 2) + nf(minute(), 2) + nf(second(), 2),10,10); push(); translate(width-20,0);
textAlign(RIGHT, TOP);
text(“To Change Destination_Press Key’0-9/ì/+/ù’\nTo Change Scope_Press Key’R/G/B/C/M/Y’\nTo Analyse Sound Wave_Press Mouse\nTo Save Image_Press key’s’”,10,30); scale(1.4);
text(“WELCOME TO INTER-GALAXY-MISSION”,6,8); pop();
23 IN TO THE GALAXY AND BACK
//
MAIN FUNCTIONS IN USE: _text 1/1
3.1.5 TEXT INSTRUCTION
//Star atoms_ Left Down Corner sh1.beginDraw(); sh1.clear();
sh1.push(); sh1.translate(width/2,height/2); sh1.scale(0.6); sh1.rotate(radians(frameCount)); float eS = map(cb,0,255,0.5,1.2); float eS2 = map(cb,0,255,0.5,2);
for(int i=0;i<5;i++){
float eX = sin(frameCount*0.1-i); float eY = -cos(frameCount*0.1-i);
sh1.push(); sh1.rotate(radians(frameCount-i*40)*1.5*eS2); sh1.fill(255,255-i*50);
sh1.noStroke(); sh1.ellipse(eX*55,eY*55,10,10);
sh1.push(); sh1.scale(eS);
sh1.ellipse(0,0,15,15); sh1.fill(c,255-i*50); sh1.ellipse(0,0,15+i*10,15+i*10); sh1.pop();
sh1.ellipse(eX*11,eY*70,8*eS,8*eS); sh1.pop(); }
sh1.stroke(255); sh1.noFill(); sh1.ellipse(0,0,110,110); sh1.pop();
sh1.endDraw(); push(); rotateX(radians(frameCount)*eS2); translate(-345,310); image(sh1, width/2, height/2); pop();
24 IN TO THE GALAXY AND BACK
// 3.1.6
MAIN FUNCTIONS IN USE: _Draw PShape _for loop 1/1
Star ATom Indicator
3.1.7 Position
Navigator
//Preview Window push();
translate(width-100,height-115); scale(0.1); strokeWeight(12); stroke(255); noFill(); image(sp1,width/2,height/2); fill(255); triangle(mouseX,mouseY-20, mouseX+30, mouseY+30, mouseX-30, mouseY+30); noFill(); rect(width/2,height/2,width+100,height+100); float PosR = sin(radians(frameCount))*400; strokeWeight(5); ellipse(mouseX,mouseY,30+PosR,30+PosR); pop(); fill(255); textAlign(RIGHT, BOTTOM); text(name,width-15,height-10); text(“CURRENT VIEW”,width-24,height-124);
25 IN TO THE GALAXY AND BACK
//
MAIN FUNCTIONS IN USE: _Draw Image _Name String 1/1
3.1.8 Position
Navigator
// sound ring
if (mousePressed){ noFill(); stroke(255); float AA=sin(frameCount/2)*5; strokeWeight(0.5); ellipse(mouseX,mouseY,80*AA*eS2,80*AA*eS2); strokeWeight(1); ellipse(mouseX,mouseY,40*AA*eS2,40*AA*eS2); strokeWeight(3); ellipse(mouseX,mouseY,20*AA*eS2,20*AA*eS2);
void sound(){ color c = sp1.get(mouseX,mouseY); float cb = brightness(c); float cs = saturation(c); float frequency = map(cs,0,255,-300,300) ; float amplitude = map(cb,0,255,0.0,0.5) ;
if (frameCount > startFrame) { SWave.play();
if (mousePressed){ SWave.freq(frequency); SWave.amp(amplitude); SWave.pan(map(mouseX, 0, width, -0.7, 0.7)); fill(0,100); ellipse(mouseX,mouseY,10*cb,10*cb); } else{ SWave.freq(10); SWave.amp(0); float NF = map(cb,0,255,400,800); noise.play(0.5); lowPass.process(noise); lowPass.freq(NF);
26 IN TO THE GALAXY AND BACK
}
} } } //
MAIN FUNCTIONS IN USE: _Draw Image _Name String 1/1 TAB 3
Sound Effect
void sound(){ color c = sp1.get(mouseX,mouseY); float cb = brightness(c); float cs = saturation(c); float frequency = map(cs,0,255,-300,300) ; float amplitude = map(cb,0,255,0.0,0.5) ;
if (frameCount > startFrame) { SWave.play();
if (mousePressed){ SWave.freq(frequency); SWave.amp(amplitude); SWave.pan(map(mouseX, 0, width, -0.7, 0.7)); fill(0,100); ellipse(mouseX,mouseY,10*cb,10*cb); } else{ SWave.freq(10); SWave.amp(0);
float NF = map(cb,0,255,400,800); noise.play(0.5); lowPass.process(noise); lowPass.freq(NF);
void keyPressed() {
if (key == ‘1’ || key == ‘2’|| key == ‘3’|| key == ‘4’|| key == ‘5’|| key == ‘6’|| key == ‘7’|| key == ‘8’|| key == ‘9’|| key == ‘0’|| key == ‘ì’|| key == ‘+’|| key == ‘ù’) {
UI_1.rewind(); UI_1.play();
} else if (key == ‘c’ || key == ‘m’|| key == ‘y’ || key == ‘k’|| key == ‘r’|| key == ‘g’|| key == ‘b’) {
UI_2.rewind(); UI_2.play();
} else if (key == ‘s’) { String timestamp = year() + nf(month(), 2) + nf(day(), 2) + “_” + nf(hour(), 2) + nf(minute(), 2) + nf(second(), 2); save(“Your Photos/”+timestamp+”.jpg”); UI_3.rewind(); UI_3.play(); } }
void mousePressed() {
if (dist(mouseX, mouseY, 140,height-20) < 25) { if (!isPlaying) { song.rewind(); song.play(); isPlaying = true; } else { song.pause(); isPlaying = false; } } }
27 IN TO THE GALAXY AND BACK
} } } // 3.2
MAIN FUNCTIONS IN USE: _Key to Sound _Save Image 1-2/2 TAB 3
28 IN TO THE GALAXY AND BACK // 3.3
FUNCTIONS IN USE: _Key to Save Image
OUTPUTS_ FINDING YOURSLEF IN THE SPACE MAIN
WHATS NEXT?
STAR FINDER
MEDIA DATABASE CUSTOMIZATION
_Space Soundtract PlayList
_Space Ambient Sound
_Updated High Quality
Nasa Images/Video _...
_Space News _Music & Image Matching
_More Function [Time/Timer/Weather..]
_Explorer Badegts
_...
WEB/APP
_A Music Visualizer
_A Relax/Meditation App
_An Essential item for Space Lover
_And More...
29 P-4
+ + =
STAR DREAMER
Course Title: SHAPES AND ALGORITHMS: COMPUTATIONAL TOOLS FOR GENERATIVE DESIGN
Program: Processing Professor: Anna Scotti
Year: July2023-Feb2024
University: Politecnico di Milano
Indiviual Project INTERGALAXY
30 ___TO BE CONTINUED
THANK YOU
TRAVEL_A STAR FINDING SIMULATION
BY JANE ZHUOAN DAI
MADE
INto the GALAXY and back