Setting up the Foundation • tim rodenbröker creative coding

Setting up the Foundation

Courses / Generative Sculptures / Setting up the Foundation

This lesson lays the foundation for the application. here you should pay attention to the following things.

  • Make sure that you enable the P3D renderer in the size() function.
  • The image can already be scaled down to the desired resolution in the setup with the resize() function. This way you can increase the performance of the sketch significantly.

Processing

PImage source;

void setup() {
  size(900, 900, P3D);

  source = loadImage("source.jpg");

  // Set the amount of tiles
  source.resize(50, 50);
}

void draw() {
  background(#f1f1f1);
  noStroke();
}

p5.js

let source;

function preload (){
    source = loadImage("source.jpg");
}

function setup() {
  
  createCanvas(900, 900, WEBGL);

  // Set the amount of tiles
  source.resize(50, 50);
}

function draw() {
  background("#f1f1f1");
  noStroke();
}

(Translation from Processing to p5.js by Sebastien Vanblaere)

Published by Tim on Wednesday September 6, 2023

Last modified on October 23rd, 2023 at 12:31

  1. Preparing the Material
  2. Setting up the Foundation
  3. Calculate the width and the height of a single tile
  4. Creating the nested for-loop
  5. Pixelization
  6. Centering the visual
  7. Voxelization
  8. Adding depth
  9. Motion Patterns
  10. Interlude: The lerpColor() Function
  11. Lerping between Pixels
  12. Wrapping Up