Extrusion & 3D computer graphics software
in
Programming Questions
•
2 years ago
Hi everybody !
I am just discovering Processing, and now studying the 'extrusion' example. This code allows to make "exploding" pixels on a flat image, considering their brightness (*see code below). Several questions come to me, without being able to resolve them yet :
- is it possible to replace the brightness c haracteristic by another one, which would be another information contained into the pixels ?
- How can I do to get the space location of every pixel in the transformed image, in order to inject it into a 3D computer graphics software (like 3ds Max, Cinema 4D, Maya, Rhino...) and get a 3D model of the processing image ?
Any idea to link Processing to a 3D computer graphics software would be most appreciated !
Thank you in advance to spend time to help me, and god save the open source community ! I hope to hear from you soon =)
*Code :
PImage extrude;
int[][] values;
float angle = 0;
void setup() {
size(640, 360, P3D);
extrude = loadImage("ystone08.jpg");
extrude.loadPixels();
values = new int[extrude.width][extrude.height];
for (int y = 0; y < extrude.height; y++) {
for (int x = 0; x < extrude.width; x++) {
color pixel = extrude.get(x, y);
values[x][y] = int(brightness(pixel));
}
}
}
void draw() {
background(0);
angle += 0.005;
translate(width/2, 0, -128);
rotateY(angle);
translate(-extrude.width/2, 100, -128);
for (int y = 0; y < extrude.height; y++) {
for (int x = 0; x < extrude.width; x++) {
stroke(values[x][y]);
point(x, y, -values[x][y]);
}
}
}
I am just discovering Processing, and now studying the 'extrusion' example. This code allows to make "exploding" pixels on a flat image, considering their brightness (*see code below). Several questions come to me, without being able to resolve them yet :
- is it possible to replace the brightness c haracteristic by another one, which would be another information contained into the pixels ?
- How can I do to get the space location of every pixel in the transformed image, in order to inject it into a 3D computer graphics software (like 3ds Max, Cinema 4D, Maya, Rhino...) and get a 3D model of the processing image ?
Any idea to link Processing to a 3D computer graphics software would be most appreciated !
Thank you in advance to spend time to help me, and god save the open source community ! I hope to hear from you soon =)
*Code :
PImage extrude;
int[][] values;
float angle = 0;
void setup() {
size(640, 360, P3D);
extrude = loadImage("ystone08.jpg");
extrude.loadPixels();
values = new int[extrude.width][extrude.height];
for (int y = 0; y < extrude.height; y++) {
for (int x = 0; x < extrude.width; x++) {
color pixel = extrude.get(x, y);
values[x][y] = int(brightness(pixel));
}
}
}
void draw() {
background(0);
angle += 0.005;
translate(width/2, 0, -128);
rotateY(angle);
translate(-extrude.width/2, 100, -128);
for (int y = 0; y < extrude.height; y++) {
for (int x = 0; x < extrude.width; x++) {
stroke(values[x][y]);
point(x, y, -values[x][y]);
}
}
}
2