maybe this is what you are looking for, not sure though.
you can load an image, or create your own PGraphics to extrude the mesh... you need peasycam for 3dview and unlekkerlib for stl export. its useful though, so i left it in there
Code://demo creating a simple mesh using a heightmap from an gif image
// change the height by moving the mouse and export pressing a key
import peasy.*;
import unlekker.data.*;
boolean record;
PeasyCam cam;
PImage img ;
int meshSize = 5;
int resX = 100;
int resY = 100;
float[][] val = new float[resX][resY];
void setup() {
size(900,600,P3D);
smooth();
background(255);
img = loadImage("heightmap.gif");
//img = loadImage("heightmap2.gif");
cam = new PeasyCam(this, 0,0,0,600);
}
void draw() {
translate(-resX/2*meshSize,-resY/2*meshSize);
for(int x =0; x<resX; x++){
for(int y =0; y<resY; y++){
val[x][y] = brightness(img.get(x,y))*mouseX/width;
}
}
background(0);
if (record) {
beginRaw("unlekker.data.STL",millis()+".stl");
}
for(int x =0; x<resX-1; x++){
for(int y =0; y<resY-1; y++){
beginShape();
colorMode(HSB,255);
fill( val[x][y],255,255);
vertex(x*meshSize,y*meshSize,val[x][y] );
vertex((x+1)*meshSize,y*meshSize,val[x+1][y] );
vertex((x+1)*meshSize,(y+1)*meshSize,val[x+1][y+1] );
vertex(x*meshSize,(y+1)*meshSize,val[x][y+1] );
endShape(CLOSE);
}
}
if (record) {
endRaw();
record = false;
}
}
void keyPressed() {
record = true;
}