I want to setup a 3D installation in our college, for that, I want to know that, whether I can setup two eye distance separated cameras in processing, and render each one to two different projectors, so that, I can blend those outputs by polarizing them and implement 3d effect.
Multiple render to two projectors using processing (for Polarization based 3D)
468 views Asked by jubin At
2
There are 2 answers
5
On
I've got a few ideas from the simpler to the more complex:
- Simply isolating drawing commands/coordinate spaces
- Using different render layers
Method 1: Simple use pushMatrix()/popMatrix() calls to isolate the left from the right viewpoints, maybe using different values for the perspective() projection
Here's a very rough example to illustrate the idea:
void setup(){
size(200,100,P3D);
noFill();
}
void draw(){
background(255);
stroke(255,0,0);
//view 1
pushMatrix();
camera(70.0, 0.0, 200.0, 50.0, 50.0, 0.0, 0.0, 1.0, 0.0);
drawBox();
popMatrix();
stroke(0,0,255);
//view 2
pushMatrix();
camera(90.0, 0.0, 200.0, 50.0, 50.0, 0.0, 0.0, 1.0, 0.0);
translate(100,0,0);//move everything to the right
drawBox();
popMatrix();
}
void drawBox(){
pushMatrix();
rotateY(map(mouseX,0,width,-PI,PI));
box(50);
popMatrix();
}
Method 2: You can separate the values/number updates from your drawing code and draw twice in the same frame, but into separate 'layers', perhaps using PGraphics instances
If you want to separate windows you can see a code example in this answer
You can open a second Window in processing by creating an instance of a PApplet and adding it to a new JFrame window. The following example creates a simple sketch that opens two windows and draws a circle slightly shifted to the left in one of them and to the right in the second one. These windows can be placed on the different projectors