import processing.video.*;
Capture camera;
void setup(){
size(640, 480, P3D);
smooth();
camera = new Capture(this, width, height);
camera.start();
}
void draw(){
background(255);
stroke(0);
fill(200);
camera.loadPixels();
for(int x = 5; x < width; x += 10){
for(int y = 5; y < height; y += 10){
color rgb = camera.pixels[y * width + x];
float brightness = map(max(red(rgb), green(rgb), blue(rgb)), 0, 255, 0, 1);
pushMatrix();
translate(x, y, 0 + -200 * brightness);
box(10, 10, 100);
popMatrix();
}
}
}