3d Wireframe exchange with drawing
in
Contributed Library Questions
•
1 year ago
i would like to exchange the wireframe in this code to a drawing i made with black lines on white surface. I want the white areas to be transparent and only the black ones should appear. Is this possible? How can i do this. I am beginner.
THANK YOU
import toxi.processing.*;
import toxi.math.conversion.*;
import toxi.geom.*;
import toxi.math.*;
import toxi.geom.mesh2d.*;
import toxi.util.datatypes.*;
import toxi.util.events.*;
import toxi.geom.mesh.subdiv.*;
import toxi.geom.mesh.*;
import toxi.math.waves.*;
import toxi.util.*;
import toxi.math.noise.*;
import toxi.geom.*;
import toxi.geom.mesh.*;
import toxi.math.noise.*;
import toxi.processing.*;
float NS = 0.05f;
float SIZE = 100;
float AMP = SIZE*4;
Mesh3D mesh;
ToxiclibsSupport gfx;
boolean isWireframe=true;
void setup() {
size(680, 382, P3D);
gfx = new ToxiclibsSupport(this);
}
void draw() {
updateMesh();
background(0);
translate(width / 2, height / 2, 0);
float rx = mouseY * 0.01f;
float ry = mouseX * 0.01f;
rotateX(rx);
rotateY(ry);
gfx.origin(100);
if (isWireframe) {
noFill();
stroke(255);
}
else {
fill(255);
noStroke();
lights();
}
gfx.mesh(mesh,!isWireframe);
}
void updateMesh() {
float phase=frameCount*NS*0.01;
BezierPatch patch = new BezierPatch();
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 4; x++) {
float xx = x * SIZE;
float yy = y * SIZE;
float zz = (float) (SimplexNoise.noise(xx * NS, yy * NS,phase) * AMP);
patch.set(x, y, new Vec3D(xx, yy, zz));
}
}
mesh=patch.toMesh(!mousePressed ? 32 : 4);
mesh.center(null);
}
void keyPressed() {
if (key == 'w') {
isWireframe = !isWireframe;
}
}
THANK YOU
import toxi.processing.*;
import toxi.math.conversion.*;
import toxi.geom.*;
import toxi.math.*;
import toxi.geom.mesh2d.*;
import toxi.util.datatypes.*;
import toxi.util.events.*;
import toxi.geom.mesh.subdiv.*;
import toxi.geom.mesh.*;
import toxi.math.waves.*;
import toxi.util.*;
import toxi.math.noise.*;
import toxi.geom.*;
import toxi.geom.mesh.*;
import toxi.math.noise.*;
import toxi.processing.*;
float NS = 0.05f;
float SIZE = 100;
float AMP = SIZE*4;
Mesh3D mesh;
ToxiclibsSupport gfx;
boolean isWireframe=true;
void setup() {
size(680, 382, P3D);
gfx = new ToxiclibsSupport(this);
}
void draw() {
updateMesh();
background(0);
translate(width / 2, height / 2, 0);
float rx = mouseY * 0.01f;
float ry = mouseX * 0.01f;
rotateX(rx);
rotateY(ry);
gfx.origin(100);
if (isWireframe) {
noFill();
stroke(255);
}
else {
fill(255);
noStroke();
lights();
}
gfx.mesh(mesh,!isWireframe);
}
void updateMesh() {
float phase=frameCount*NS*0.01;
BezierPatch patch = new BezierPatch();
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 4; x++) {
float xx = x * SIZE;
float yy = y * SIZE;
float zz = (float) (SimplexNoise.noise(xx * NS, yy * NS,phase) * AMP);
patch.set(x, y, new Vec3D(xx, yy, zz));
}
}
mesh=patch.toMesh(!mousePressed ? 32 : 4);
mesh.center(null);
}
void keyPressed() {
if (key == 'w') {
isWireframe = !isWireframe;
}
}
1