Creative coding

I’m NOT a visual artist, but I love to experiment with visual arts 🙂

Lifebox restyled

One amazing thing about Lifebox is that you can use the original lifebox algorithm to create a new set of visuals, enhancing the creativity and searching new ways to show the data.

The shape of life II

The shape of life is a visual art creation based on the simplified version of the Lifebox algorithm.

The Lifebox metaballs

Lifebox metaballs is another artistic interpretation based on the simplified version of the Lifebox algorithm created using isosurfaces.

loadPixels();
  for (int xPixel = 0; xPixel < width; xPixel++) {
    for (int yPixel = 0; yPixel < height; yPixel++) {
      int indexPixel = xPixel + yPixel * width;
      float sum = 0;
      for (int x = 0; x < matrixSizeX; x++) {
        for (int y = 0; y < matrixSizeY; y++) {
          float intensity = (float((plantsMatrix[x][y][0] * plantsMatrix[x][y][1])/20) / (dist(xPixel, yPixel,plantsMatrix[x][y][2],plantsMatrix[x][y][3])/1.1));
          sum += intensity * 0.8;
        }
      }
      if (noColor) {
        pixels[indexPixel] = color(sum);
      } else {
        pixels[indexPixel] = color(constrain(sum,10,220),100,200);
      }
      //println(sum);
    }
   }
  updatePixels();

Life explosion

Other creations

Perlin Noise experimentation: the moon & 80’s tron

int scl = 20;
int w = 2000;
int h = 2000;
int cols,rows;

float flying = 0;
float rotate = 0;

float[][] terrain;
float[][] colorofvertex;

void generateTerrain(float distance) {
float yoff = 0 + distance;
  for (int y = 0; y < rows; y++) {
    float xoff = 0;
    for (int x = 0; x < cols-1; x++) {
      terrain[x][y] = map(noise(xoff,yoff),0,1,-100,10);
      colorofvertex[x][y] = map(noise(xoff,yoff),0,1,0,200);
      xoff = xoff + 0.2;
    }
    yoff = yoff + 0.2;
  }
}

void setup() {
 size (1000,1000,P3D);
 cols = w / scl;
 rows = h / scl;
 terrain = new float[cols][rows];
 colorofvertex = new float[cols][rows];
 
 generateTerrain(0.0);
    
}

void draw() {
  
  //flying = flying - 0.2;
  generateTerrain(flying);
  background(0);
  stroke(255);
  noFill();
  translate(width/2,height/2);
  rotateX(PI/2.2);
  rotateZ(PI+rotate);
  translate(-w/2,-h/2);
  for (int y = 0; y < rows-1; y++) {
    beginShape(TRIANGLE_STRIP);
    for (int x = 0; x < cols-1; x++) {
      stroke(100);
      fill(int(colorofvertex[x][y]));
      vertex(x*scl,y*scl,terrain[x][y]);
      vertex(x*scl,(y+1)*scl,terrain[x][y+1]);
    }
    endShape();
  }
  if (keyPressed == true) {
    if (key=='w') flying = flying + 0.12;
    if (key=='s') flying = flying - 0.12;
    if (key=='a') rotate = rotate + 0.2;
    if (key=='d') rotate = rotate - 0.2;
  }
}

Perlin noise animation: sea at night

PImage bg;

int scl = 20;
int w = 3000;
int h = 2000;
int cols,rows;

float flying = 0;
float wave = 0;
float rotate = 0;

float[][] terrain;
float[][] colorofvertex;

void generateTerrain(float distance,float wave) {
float yoff = 0 + distance;
  for (int y = 0; y < rows; y++) {
    float xoff = 0;
    for (int x = 0; x < cols-1; x++) {
      terrain[x][y] = map(noise(xoff,yoff),0,1,-80,10)+map(noise(xoff+wave+sin(xoff),yoff+wave+cos(yoff)),0,1,-10,10)*2;
      colorofvertex[x][y] = map(noise(xoff,yoff),0,1,0,30)+map(noise(xoff+wave+sin(xoff),yoff+wave+cos(yoff)),0,1,-0,70)*2;
      xoff = xoff + 0.2;
    }
    yoff = yoff + 0.2;
  }
}

void setup() {
 bg = loadImage("starsBg.jpg");
 //size (1920,1080,P3D);
 fullScreen(P3D);
 cols = w / scl;
 rows = h / scl;
 terrain = new float[cols][rows];
 colorofvertex = new float[cols][rows];
 
 generateTerrain(0.0,0.0);
    
}

void draw() {
  background(bg);
  wave = wave + 0.02;
  generateTerrain(flying,wave);
  stroke(255);
  noFill();
  translate(width/2,height/2);
  rotateX(PI/2.2);
  rotateZ(PI+rotate);
  translate(-w/2,-h/2);
  for (int y = 0; y < rows-1; y++) {
    beginShape(TRIANGLE_STRIP);
    for (int x = 0; x < cols-1; x++) {
      stroke(0,0,colorofvertex[x][y]-50);
      fill(0,0,colorofvertex[x][y]);
      vertex(x*scl,y*scl,terrain[x][y]);
      vertex(x*scl,(y+1)*scl,terrain[x][y+1]);
    }
    endShape();
  }
  delay(10);
}

More information and source code at https://github.com/ferrithemaker/Jumble/tree/master/processing