We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm taking in an image via Syphon and simply using the brightness of the image/frame as the Z value for that pixel. So you end up with a bunch of points in 3d space from the 2d image. However, I'd like to make this into a mesh so that it's one contiguous shape, with each vertex colored correctly.
beginShape(TRIANGLE_STRIP);
for (int y = 0; y < img.height; y+=skip) {
for (int x = 0; x < img.width; x+=skip) {
int index = y * img.width + x;
color c = img.pixels[index];
float b = brightness(c);
// smoothing
pZ[index] = (b * .05) + (lastPZ[index] * .95);
lastPZ[index] = pZ[index];
stroke(c);
fill(c);
vertex(x, y, -100 + pZ[index]);
}
}
endShape();
Something like that, except of course TRIANGLE_STRIP isn't going to work here. I need something that will figure out which vertices ought to be connected.
Answers
I've taken a look at this post: https://forum.processing.org/one/topic/creating-an-irregular-3d-mesh.html
But I don't see how the conversion to 3d actually helps, since you'd still need a way to identify the correct vertices to manipulate the Z axis.