Transparency problem
in
Programming Questions
•
1 year ago
Hi everyone i'm new on processing, and I can't get a good trasparency effect, if you try my example you will notice that where the spheres intersect the transparency is not always working. Can be solved? what i'm doing wrong?
Thanks .
Thanks .
- import processing.opengl.*;
float rotation=0;
void setup() {
size(800, 800, OPENGL);
background(255);
smooth();
}
void sensor_position(int number){
noStroke();
pushMatrix();
if (number==1){
fill(0,255,0,255);
translate(12.5,+12.5,-12.5);}
if (number==2){fill(255,0,0,255);
translate(12.5,+12.5,+12.5);}
if (number==3){ fill(0,0,255,255);
translate(-12.5,+12.5,0);}
sphere(1);
popMatrix();}
void draw() {
background(255);
//lights();
float orbitRadius= 50;//mouseX/2+50;
float rotation=mouseX;
float ypos= 20+mouseY/5;
float xpos= cos(radians(rotation))*orbitRadius;
float zpos= sin(radians(rotation))*orbitRadius;
camera(xpos, ypos, zpos, 0, 0, 0, 0, -1, 0);
noFill();
stroke(0);
box(25);
sensor_position(1);
sensor_position(2);
sensor_position(3);
fill(0,255,0,20);
noStroke();
pushMatrix();
translate(12.5,+12.5,-12.5);
sphere(20);
popMatrix();
fill(255,0,0,20);
pushMatrix();
translate(12.5,+12.5,+12.5);
sphere(20);
popMatrix();
fill(0,0,255,20);
pushMatrix();
translate(-12.5,+12.5,0);
sphere(20);
popMatrix();
}
1