Using multiple projectors
If you want to projection map a physical object from more than one angle, you'll need to use more than one projector. Shape Mapper supports calibrating mappings of a single shape across multiple projectors.
Hardware considerations
If you can connect multiple projectors to your computer directly, great! If not, you'll need a video wall controller like this one.
Write the Processing sketch
Starting from the code in the Getting Started tutorial, we need to make a couple of modifications.
-
In addition to importing the main
ShapeMapper
class, you'll also need to import two other classes,MappedShape
andMapping
: -
We'll need to store a reference to a
MappedShape
in the top level of our sketch. -
Modify the setup function to add a shape with the
addShape(...)
method.myShape = createShape(BOX, 150); mapper = new ShapeMapper(this); mappedShape = mapper.addShape("box", myShape, 2);
This alternate way of initializing the library has two important differences:
- The third parameter of
addShape()
specifies the number of mappings to create, which corresponds to the number of projectors you have. addShape()
returns aMappedShape
, which you can store for use in yourdraw()
function.
- The third parameter of
-
Now modify the draw function with this code:
for (Mapping mapping : mappedShape.getMappings()) { mapping.beginMapping(); shape(myShape); mapping.endMapping(); }
This will loop through the list of mappings and draws a separate perspective for each projector.
-
Putting it all together:
import spacefiller.shapemapper.ShapeMapper; import spacefiller.shapemapper.MappedShape; import spacefiller.shapemapper.Mapping; ShapeMapper mapper; PShape myShape; MappedShape mappedShape; void setup() { fullScreen(P3D); myShape = createShape(BOX, 150); mapper = new ShapeMapper(this); mappedShape = mapper.addShape("box", myShape, 2); } void draw() { background(0); for (Mapping mapping : mappedShape.getMappings()) { mapping.beginMapping(); shape(myShape); mapping.endMapping(); } }
Calibrate the projection mapping
- Run the sketch.
- Hit
Space
to switch fromRender
mode toCalibrate
mode. - Click a point on your model to select it.
- Hit
Tab
to switch to mapping mode. -
Look at your object in physical space and move your mouse so that the crosshairs are centered on the corresponding vertex of the physical object. Click to create a point in the projected space.
-
Hit
Tab
to switch back to point selection. Choose another point and repeat the process. - After mapping 6 points, a full calibration will be automatically estimated.
- Now press
Right →
to switch to the next mapping. - Repeat steps 3-7 on your second projector.
Face masking
If you have a face of your physical object which both projectors are mapping, you can mask out the face on one of the mappings to avoid drawing it twice.
- Face masking requires that your geometry be structured in a specific way. Your top level
PShape
must be a parent of childPShape
s which represent the faces. If you export an.obj
file from Blender and import it into Processing, this is the default representation. - Once you have calibrated your mappings, switch to face masking mode.
- Press
Space
to switch toCalibrate
mode. - Press
M
to enableMask faces
.
- Press
- Press
← Left
orRight →
to choose the mapping you want to mask. -
Click a face to toggle it on or off.
-
Now press
Space
to switch back toRender
mode. The faces you have selected should be masked out.