Archive for April, 2007

Update: This hack is obsolete as of Processing 0133. Read more here.

I’ve previously mentioned the problem of anti-aliasing not working properly in OpenGL, which is particularly bothersome for MacOS users who can’t use a graphics card control panel to override application settings to force AA. Mike Creighton posted source for a hack on the Processing forums that modifies PGraphicsOpenGL to force AA. I’ve created a simple version of this hack and made a replacement for the opengl.jar that comes with Processing.

This hack should work for Processing 0124 on Mac and PC. Simply download the opengl.jar below and drop it into the “libraries\opengl\library” subfolder of your Processing application directory. Make sure to make a backup of the original opengl.jar first in case this doesn’t work for you. Once replaced, the new PGraphicsOpenGL class should always initialize with 4x supersampling. Please leave comments on this post to let me know if it works for you.

Downloads

8 Comments »

April 30 - May 4: Advanced Processing workshop at Hyperwerk, Basel, Switzerland. Follows up on the introductory workshop from December 2006.

Some of the topics that will be covered in this workshop:

- OOP, inheritance and polymorphism (tutorial, shiffman.net)
- 3D mesh generation & storage
- Basic code optimization
- Vector forces and agent behavior
- Writing code with Eclipse
- Using / writing libraries

Files for this workshop can be found at the following address: http://workshop.evolutionzone.com/workshops/070430_hyperwerk/.

No Comments »

For two joined bezier curves to be continuous (i.e. no corners or abrupt slope changes), the control points on each side of the joining point must be colinear. This behavior is default in vector editing programs like Adobe Illustrator.

An example in Processing:

// BezierJoins.pde
// Marius Watz - http://workshop.evolutionzone.com

void setup() {
  size(400,400);
}

void draw() {
  background(200);
  noFill();

  float xD=width/2-mouseX;
  float yD=height/2-mouseY;  

  bezier(0,0,
    300,100,
    width/2-xD,height/2-yD,
    width/2,height/2);

  bezier(width/2,height/2,
    width/2+xD,height/2+yD,
    400,300,
    400,400);
}

1 Comment »

DIGG announced the launch of the public DIGG API yesterday. I’m not a DIGG fan myself, but it is a major service so the launch is significant.

The API should enable more visualizations along the lines of the popular Swarm and Bigspy visualizations. This is clearly part of the interest on DIGG’s part, as they have also announced a DIGG API Visualization contest. Entries must use the Flash toolkit provided by DIGG.

You can read more about the launch on the DIGG blog. Basic API concepts are fleshed out here.

3 Comments »

[Merz Akademie workshop] Here is the code I wrote to create a 3D mesh by rotating a set of 2D points:

// 3dmesh.pde
// Marius Watz - http://workshop.evolutionzone.com

import processing.opengl.*;

int numrot;
float px[],py[],mesh[][][];

void setup() {
  size(700,700, OPENGL);

  // To create a mesh, first create two arrays to hold the
  // X and Y coordinates of the path you will use to create it
  px=new float[20];
  py=new float[20];
  float t=0;
  for(int i=0; i< px.length; i++) {
    px[i]=bezierPoint(0,130, 130, 0, t);
    py[i]=bezierPoint(450,350,150,50, t);
    t+=(1.0/(float)(px.length-1));
  }

  // use createMesh to create the mesh. createMesh takes three parameters:
  // num == number of rotations
  // startDeg == start degree of rotation
  // endDeg == end degree of rotation

  mesh=createMesh(px,py,20, -60,60);
}

void draw() {

translate(width/2,height/2);
  pushMatrix();

  background(0);
  lights();

  rotateY(radians(frameCount));
  rotateX(radians(frameCount)/2);

  stroke(255);
  noStroke();
  fill(255,120,0);

  translate(0,0);
  for(int i=0; i< 6; i++) {
    rotateZ(radians(60));
    pushMatrix();
    rotateX(radians(-60));

    // to draw the mesh, use drawMesh and pass your mesh variable to it
    drawMesh(mesh);
    popMatrix();
  }

  popMatrix();
}

float [][][] createMesh(float px[],float py[],int numrot,
  float startDeg,float endDeg) {

  float deg,x,z;
  double cosval,sinval,tmp1,tmp2;

  float [][][] mesh=new float[numrot][px.length][3];
  endDeg-=startDeg; 

  int meshindex=0;
  for(int i=0; i< numrot; i++) {
    deg=radians(startDeg+(endDeg/(float)(numrot-1))*(float)i);
    for(int j=0; j< px.length; j++) {
      x=px[j];
      z=0;
      cosval=Math.cos(deg);
      sinval=Math.sin(deg);
      tmp1=x*cosval - z*sinval;
      tmp2=x*sinval + z*cosval;
      mesh[i][j][0]=(float)tmp1;
      mesh[i][j][1]=py[j];
      mesh[i][j][2]=(float)tmp2;
    }
  }

  return mesh;
}

void drawMesh(float mesh[][][]) {
  println(mesh.length+" "+mesh[0].length+" "+mesh[0][0].length);
  for(int i=0; i< mesh.length-1; i++) {
    beginShape(QUAD_STRIP);
    for(int j=0; j< mesh[0].length; j++) {
      vertex(mesh[i][j][0],mesh[i][j][1],mesh[i][j][2]);
      vertex(mesh[i+1][j][0],mesh[i+1][j][1],mesh[i+1][j][2]);
    }
    endShape();
  }
}

1 Comment »

[For workshop at Merz Akademie]

Remember Philip Galanter’s definition of generative art:

Generative art refers to any art practice where the artist uses a system, such as a set of natural language rules, a computer program, a machine, or other procedural invention, which is set into motion with some degree of autonomy contributing to or resulting in a completed work of art. "What is Generative Art? Complexity Theory as a Context for Art Theory"

See also Generative art on Wikipedia.

Types of generative systems

Generative systems can be broken down in basic types. In reality, most works combine several types.

Randomized composition
- Joshua Davis: Kimono sketch
- Erik Natzke: Experiments
- Michael Meredith: Ivy
- William Burroughs: Cut-up technique (see also this page)

Kinetic systems
- Casey Reas: Process 9
- Marius Watz: Illuminations A

Formal grammars
- 12-tone composition
- Shape grammars
- Chris Coyne: Context free design grammar

Biological models
- Genetic algorithms
- Karl Sims: Evolved Virtual Creatures (see movie)
- Cellular Automata: Conway's Game of Life
- L-systems
- Algorithmic Botany

Analytical / data-based
- Ben Fry: Anemone
- Martin Wattenberg: Shape of Song

Game strategies
- Alison Mealey: Unreal Art

Performance systems:
- Golan Levin: AVES
- Generator.x concert tour: Lia, Frank Bretschneider, Marius Watz

1 Comment »

I’m currently doing a workshop on “Generative systems in Processing”. Files from the workshop will be available here:
http://workshop.evolutionzone.com/workshops/070416_merz/code/

No Comments »

070411_projection.jpg

Realities United: BIX facade / Evan Roth: GraffitiAnalysis

Notes for workshop about projection and installation in public space at Westerdals School of Communication .

Strategies
- Think space, not screen
- Qualities of projection: Fluid, temporary
- Image as furniture
- Consider interactivity
- Media facades: Image becomes architecture
- Information flow: Realtime infostreams

Urban space
- Evan Roth: GraffitiAnalysis
- Graffiti Research Lab: Projection bombing
- Gunnar Green / Richard The / Frederic Eyl: Parasite subway projection
- Lab[au]: Touch installation, Dexia Tower
- Art+Com: Vattenfall media facade
- Realities United: Media facades
- AG4: Media facades
- Element Labs: Sexy LED technology

Installation
- Artificel: Condemned_bulbes
- Mark Hansen / Ben Rubin: Listening post (YouTube)
- Art+Com: Floating Numbers
- UVA: Volume

Sound + image
- Lia: Flow
- Patric Schmidt / Benedikt Groß: Seelenlose Automaten
- Dein Lieblingsgestalter: Fabri Fibra visuals

Non-electronic
- Johan Löfgren: Market
- Dean Sameshima: Numbers
- Jen Stark: Paper sculpture
- Space Invader: RUBIKCUBISM
- Eno Henze: Metaphysischer Grenzverkehr I
- Alexandre Orion: Ossario
- Fred Eerdekens: Work with light and shadow
- John Powers: SciFi Wahabi #1
- Yayoi Kusama: Dots Obsession - New Century, 2000

2 Comments »

I’ve just learned some handy tricks about packaging Processing-based applications with OpenGL for deployment on Mac OS X. As it turns out, it’s remarkably easy to do on a PC if you use Processing’s own application export as a template. My thanks to Ben Fry for the tip (and also for all the other hard work he’s put into Processing…)

Create a sketch called “Dummy” in the Processing GUI. If your final application will use OpenGL, make sure that “Dummy” does as well. Export using “Export as application”. This produces several folders, of which only “application.macosx” is of interest. This has a “Dummy.app” subfolder which is the actual MacOS application. It’s not a single file, but rather a folder structure that on a Mac shows up as a clickable application. Change the name of “Dummy.app” to whatever name you want, keeping the magic “.app” extension.

In “Contents” you will find a file called “Info.plist”. This contains various parameters controlling your Java application, bundled as pairs of <key> and <string>. Make sure that “MainClass” string is the full name of your main class (including package name if any). Change all instances of “Dummy” to the name of your application. You can also tweak a bunch of other options at will.

If you have JAR files that you need to add, place them in the subfolder “Contents\Resources\Java”. It should already contain core.jar as well as the OpenGL-related JARs and jnilib libraries if you exported Dummy with OpenGL imported. You will need to include the new JARs in the “ClassPath” string found in “Info.plist”.

If all changes have been done correctly, you should now have a runnable application. Copy it to a Mac for testing.

For some icing on the cake (and as an alternative to present mode), you can hide the dock and menu bar on application start. Add the following lines to the <dict> section of “Info.plist”:

LSUIPresentationMode
4

Thanks to Vitaflo for his post on the Processing Forums for this tip.

If you compile your code including the Processing source in an IDE like Eclipse, you can simply replace core.jar with your own as long as it contains all the usual Processing class files. I’ve made a few small changes to the PApplet class, so I prefer this option to the standard JAR file.

This is particularly pertinent if you want your OpenGL apps to be anti-aliased on Mac OS, since smooth() does not always turn it on. The solution is to make an alteration to PGraphicsOpenGL using the GLCapabilities class. Read Mike Creighton's post on the Processing forums for the details.

1 Comment »

…what you like and don’t like about them. If you want to share, go answer their survey. As a loyal long-time user I just did it, it only takes about 2 minutes.

It seems like del.icio.us is at a crucial juncture right now. They have a loyal user base and a ton of data, but the web site feels clunkier by the day. Not because it’s actually getting worse, but because it’s not getting any better. A better design for presentation and navigation is desperately needed. del.icio.us director makes the site a bit more usable, but I can’t help but wonder why the core team hasn’t tried to do even better than that.

As it stands, I use del.icio.us every day through the excellent Firefox extension, but I barely ever visit the site. It simply doesn’t help me very much to do so. Yahoo or no Yahoo, I’d love to see del.icio.us regain their cutting edge. I mean, they almost single-handedly made tags the killer app of Web 2.0.

Read more about the thoughts of the del.icio.us team on overdue New Year's resolutions.

No Comments »