I saw
this video and I was figuring out how the triangulation effect was made...
I asked them, but no reply from the authors... who wants to try to help me?
Hi i was trying to achieve a 3d pixel effect from a video modifying a script i made for a capture...
But for the video I keep on getting an "ArrayIndexOutOfBoundsException: 4810" error !!!
Where am I wrong ?
This is the code working with a CAPTURE
import processing.video.*;
Capture video;
int cellsize = 20; int cols, rows;
void setup() { size(640,480,P3D); video = new Capture(this,width,height,30); // Load the video cols = width/cellsize; // Calculate # of columns rows = height/cellsize; // Calculate # of rows }
void draw() { if (video.available()) { video.read(); }
background(0);
video.loadPixels();
// Begin loop for columns for (int i = 0; i < cols; i++ ) { // Begin loop for rows for (int j = 0; j < rows; j++ ) { int x = i*cellsize + cellsize/2; // x position int y = j*cellsize + cellsize/2; // y position int loc = x + y*width; // Pixel array location color c = video.pixels[loc]; // Grab the color
// Calculate a z position as a function of pixel brightness float z = -(800/(float)width) * brightness(video.pixels[loc])- 100.0;
// Translate to the location, set fill and stroke, and draw the rect pushMatrix();
void draw() { if (video.available()) { video.read(); }
background(0);
video.loadPixels();
// Begin loop for columns for (int i = 0; i < cols; i++) { // Begin loop for rows for (int j = 0; j < rows; j++ ) { int x = i*cellsize + cellsize/2; // x position int y = j*cellsize + cellsize/2; // y position int loc = x + y*width; // Pixel array location color c = video.pixels[loc]; // Grab the color
// Calculate a z position as a function of pixel brightness float z = -(500/(float)width) * brightness(video.pixels[loc])- 100.0;
// Translate to the location, set fill and stroke, and draw the rect pushMatrix();