Using setupOffAxisViewPort with ofxMostPixelsEver

Hi all,

I am using ofxMostPixelsEver to spread a 3D scene across two machines. Because the scene is 3D, I figured that rather than setting the mesh vertexes according to each screen’s offsets, all of my scene’s position data should be in the same place, and I should offset the two camera axis instead. Would this be possible using ofCamera::setupOffAxisViewPort()? I’ve peeked around the 3d/cameraLensOffsetExample, but that usage is a bit too specific for me to understand how to apply it to my situation. Essentially, I want a behavior similar to this cinder demo (using their port of Most Pixel’s Ever).

Below is some example code that I am working with. I assume that I am setting up the off axis view portal incorrectly, but I can’t figure out how it should be set. Am I even on the right track?


// in setup()
    ofVec3f topLeft(client.getXoffset(), client.getYoffset());
    ofVec3f bottomLeft(client.getXoffset(), client.getYoffset() + client.getLHeight());
    ofVec3f bottomRight(client.getXoffset() + client.getLWidth(), client.getYoffset() + client.getLHeight());
    
   cam.setupOffAxisViewPortal(topLeft, bottomLeft, bottomRight);


// in draw()
    ofBackground(0);
    client.placeScreen3D();
    cam.begin();

	ofScale(2, -2, 2); // flip the y axis and zoom in a bit

	mesh.draw();

	cam.end();
    client.restoreCamera();

1 Like

I’ve been thinking about the same thing – here’s a small example that might help?

it’s essentially splitting the screen off into 3 different regions and it uses one camera, positioned where the camera that would be doing the whole screen would be but using those sub regions as the axis to align to. If you hold down the mouse you can see how just shifting the content doesn’t line up, but using setupOffAxisViewPort does. One oddity was having to use the -z value of the main camera, it seems like something is wrong / inverted in this code?

hope this helps, I’m not 100% this is a great example, so pinging @elliotwoods or anyone else who knows about this functionality…

2 Likes

with the mouse pressed you get the bad solution (just shifting things around) :

unpressed, we align the camera each time we draw one of these strips, and you can see the image stitch together again

2 Likes

to test even further, here’s the same thing into fbos of different sizes, notice how the line width changes (because of different resolutions) but it all still lines up…

2 Likes

hey!

yes setupOffAxisViewPort is the way to go
looks like zach has got you covered
the topLeft, topRight, bottomRight are the corners in 3D space of each viewport (each rendering)

so as long as you can calculate those 3d positions for the edges of your different windows and keep the camera position the same for all of them, you should have the result you need

(p.s. understand i’m a bit late to help here, but hopefully this explanation can additionally support anybody else with the same issue)

2 Likes

Thanks @zach and @elliotwoods for the detailed responses. I ended up not using Most Pixels Ever as the space I was showing in had 6 projectors synced to and driven by 1 machine (no kidding), so no harm in the delay. That said this is very helpful for the future and hopefully a nice resource for others peeking around.