2D&3D Reaction diffusion
Friday, January 20th, 2012







2D reaction: http://openprocessing.org/visuals/?visualID=50777
3D reaction with toxiclibs: http://openprocessing.org/visuals/?visualID=50956








2D reaction: http://openprocessing.org/visuals/?visualID=50777
3D reaction with toxiclibs: http://openprocessing.org/visuals/?visualID=50956




Influenzavirus visualization.
Made with Processing.
Anche quest’anno un piccolo ed aggressivo virus mi ha messo a tappeto per un paio di giorni; ma come sarà fatto, che aspetto avrà mai? Ecco come possono apparire questi mostruosi rompiballe… ma intanto sono già guarito, tiè.
Ma è di questi giorni la notizia che l’Università Erasmus Medical Center di Rotterdam, sia in procinto di pubblicare i risultati di uno studio effettuato sul virus H5N1 (il virus dell’aviaria o bird flu). I ricercatori di una delle più importanti Università olandesi hanno scoperto che H5N1 potrebbe rapidamente modificarsi in una forma altamente contagiosa per l’uomo, e lo hanno dimostrato testandone una versione modificata su dei furetti, che hanno un sistema respiratorio molto simile a quello umano. Il virus creato nei super laboatori di Erasmus MC è ora trasmissibile per via aerea, basta cioè uno starnuto per propagarlo da uomo a uomo (fino ad ora, in natura, il contagio avviene solo da volatile a uomo: mangiandone le uova o le carni non cotte o mal cotte, lavorando in un pollaio con animali infetti, e toccandoli). Questa mutazione genetica può avvenire in natura (per ora non è ancora successo) ma conoscere quale sia la mutazione che lo renderebbe devastante ci può aiutare a combatterlo in caso di pandemia; possiamo tenerlo d’occhio e vedere se con l’insorgere dei prossimi focolai (è già in atto un nuovo focolaio in Vietnam), questo si stia modificando nella direzione che temiamo. Lo studio è stato effettuato col contributo del ministero per l’ambiente e per le infrastrutture olandesi, ed in parte commissionato dall’ American National Institutes of Health. La polemica è forte anche sul piano della pubblicazione di questi studi: c’è chi pensa che sia una pessima idea rendere pubblici gli step necessari a renderlo il virus che potrebbe spazzare via il 60% della popolazione umana; ricordiamoci che un virus del genere può essere usato come arma di distruzione di massa. Paura? Beh io riporto solo la notizia, anche perchè per caso è uscita proprio oggi che pubblico questi mostriciattoli 3D. Coincidenze?


CA Grid.
Made with Processing.
An effective method to save a frame with a different size than the size of the 3D sketch you’re drawing, is to use a PGraphics to make an enlarged copy of the scene; this image (click on it) has been created from the webcam feed wich is normally set to 320×240 pixels; when you create a PGraphics (Processing’s main graphics and rendering context) you must specify the width and height of the object itself; try to multiply the sketch’s original size by 10. You get images of 3200×2400 pixels or more. See hi-res anemone and hi-res webcam feed, they’re both transparent png files saved with this technique from two of my sketches.
void keyPressed()
{
switch(key) {
case 's':
noLoop();
drawbg = false; // this is a boolean wich you can use to remove the background from the main draw() method; eg: if(drawbg) background(255)
recorder = createGraphics(width*10, height*10, P3D); // original app size is multiplied by 10
recorder.beginDraw();
cam.getState().apply(recorder); // useful for 3D scenes, sync the perspective - you need the peasyCam library, applies the latest CameraState
draw();
recorder.endDraw();
recorder.save("test.png"); // save to disk (skecth folder)
recorder = null;
println("screenshot saved");
loop();
break;
}
}




Re-constructed structures.
Made with Processing+Hemesh+SunflowApiApi.
Creating meshes is cool (for a given amount of cool) but destroying them is even cooler. (W:Blut)
True, but once a mesh is modified (with the Lattice modifier, for example) how can we re-construct the shape keeping track of the removed ones? I wanted a way to render some glass-looking windows on the buildings faces and discovered (hacked) a way to re-generate a polygon (a new cube but still missing the 6th face) where initially a hole have been created. One can draw the polygons by going through the WB_Point array of each poly, creating a polygon for every face you delete.
import wblut.hemesh.*;
import wblut.hemesh.creators.*;
import wblut.hemesh.modifiers.*;
import wblut.hemesh.subdividors.*;
import wblut.hemesh.kdtree.*;
import wblut.hemesh.tools.*;
import wblut.geom.*;
import wblut.math.*;
import peasy.org.apache.commons.math.*;
import peasy.*;
import peasy.org.apache.commons.math.geometry.*;
HE_Mesh mesh, holes;
PeasyCam cam;
HE_Selection selection;
ArrayList<WB_Polygon> removedPolys = new ArrayList<WB_Polygon>();
ArrayList<WB_Quad> qua = new ArrayList<WB_Quad>();
void setup()
{
size(650, 650, P3D);
cam = new PeasyCam(this, 450);
HEC_Creator cube = new
HEC_Box(this).setWidth(100).setWidthSegments(5)
.setHeight(100).setHeightSegments(5)
.setDepth(100).setDepthSegments(6);
mesh = new HE_Mesh(cube);
selection=new HE_Selection();
Iterator fItr=mesh.fItr();
HE_Face f;
while(fItr.hasNext()){
f=fItr.next();
if(random(100) < 50){
selection.add(f);
removedPolys.add(f.toPolygon());
}
}
HEM_Lattice lattice = new HEM_Lattice().setDepth(6).setWidth(3);
mesh.modifySelected(lattice, selection);
for (WB_Polygon wb:removedPolys){
for(int i = 0; i < wb.points.length; i+=4){
WB_Quad wbq = new WB_Quad(wb.points[i], wb.points[i+1], wb.points[i+2], wb.points[i+3]);
qua.add(wbq);
}
}
HEC_FromQuads hfq = new HEC_FromQuads(this).setQuads(qua);
holes = new HE_Mesh(hfq);
HEM_Extrude extrude = new HEM_Extrude().setDistance(1);
holes.modify(extrude);
}
void draw()
{
background(255);
lights();
noStroke();
fill(220);
mesh.drawFaces();
fill(#B90202, 70);
holes.drawFaces();
}


3D mirror buildings created with Processing+Hemesh and rendered with SunflowApiApi.

HEC_Geodesic. made with Processing and Hemesh.
These incredible shapes have been created with Hemesh, a library for Processing created by Frederik Vanhoutte (W:Blut) for creating and manipulating 3D meshes. I just downloaded the lib and started coding, trying to render them with Christopher Warnow’s SunflowApiApi. So far, these are the results. Amazing libraries!


After some figuring out, I got SunflowApiApi to work directly from Processing! Still did not get perfectly how to use the 8 available shaders and how to set up the scene global illumination, but the first results are impressive.
Applet and source code: http://www.openprocessing.org/visuals/?visualID=17064
Type a search term and press ENTER; UP/DOWN keys toggles images/descriptions.
made with Processing.
This thread has lit the spark! Using the code provided by Gustav Bjordal in his PhotoWall sketch, I developed a very quick prototype wich a) connects to the Flickr API service and performs a query with a user-defined keyword, b) parses (with the proXML lib, tho I could have used the default processing xml parsing cababilities) the response, c) creates a matching number of texturized boxes, d) draws a sphere made of randomly sized boxes properly rotated along the surface. It is a signed Applet (Applets are normally executed in a sandbox that prevents them from accessing the local hard disk/network) so you’ll have to grant all the alerts that may pops up at first run.
Not the smartest way to query Flickr, but it’s been cool to code.
Applet and source here.
Merry Christmas, everyone!

We Are Pixels (extended version)
Press keys a,b,c,d,e to morph within sentences.
http://www.openprocessing.org/visuals/?visualID=16766