After Effects + MadMapper and How to map a building…

In this tutorial, we’ll use After Effects to produce a QuickTime movie that we will remap on a building.

We’ll also need Photoshop to adjust our initial pictures. The effect we’re after is a Glowing-Scan of the building.

The technique is rather simple, but it illustrates the process to achieve a photo-based architectural mapping.

This tutorial assumes that you know the basics of Adobe Photoshop + After Effects and MadMapper.

STEP#1:
Select a building to map and take a few pictures of it.
For this tutorial, we’ll need 2 distinct pictures:
– 1 picture of the building that we’ll use as a starting reference point for our mapping. This is typically a ground-level photo one would take while on location.
– 1 other picture of the building, from a different point of view, in order to really test MadMapper’s ability to map. For the purpose of this tutorial this second picture is used to simulate the projector’s point-of-view.

Here’s the first picture we’ll use, loaded into Photoshop:

STEP#2
Now we’ll need to correct the perspective of this photo, in order to have a flat view of the building. For this task, we can use the Crop tool of Photoshop, with the Perspective option enabled.

Note that since the building is symetrical, we only need one half. This is nice because the right part of the photo is obstructed by the fountain on the foreground. So select the relevant part of the building we want to correct and align the gizmo into a straight.

Note the right part aligned with the middle of the center window and front door.
Once adjusted, press return to apply the perspective cropping.

STEP#3
Create some guides on the straight parts of the building.
Since the cropping was not 100%, we’ll now have to distort manually the image.
Double click the “background” in the layer view, to turn it to a real floating layer.

STEP#4
Now press Command-T to transform this layer. Right click and select Distort.
Adjust the corners to match the straight lines of the building to the guides you just created.
Press return to apply the transformation when you’re done.

STEP#5
Since we have only one side of the building, we’ll need to duplicate it.
Go to Image/CanvasSize to extend the canvas horizontally:

STEP#6
Duplicate the layer and flip it horizontally by pressing Command-T and right click and select Flip.

STEP#7
Mark the features of the building.
First make a black layer and place it on top of the layer stack.
Set its opacity to 70%. That way, we’ll darken the composition.
Make a new layer on the very top of the layer stack.
On that layer, draw some white lines on the main features of the building.
We’ll need this in MadMapper to help us adjust our mapping.
These are in-picture guides that will make your life easier.
As you can see, I’ve just marked a few relevant features, not the whole building.

STEP#8
Resize the file to something usefull, like 1024 by xxx (where the xxx is automaticaly computer by Photoshop)
Here the file is 1024 by 618, which is ok for MadMapper.

Save the Photoshop file as a PSD.
Flatten the composition and save the file again as a JPEG, giving it a different name.
We will need the PSD file containing all the layer for further manipulations in After Effects, and the flattened JPEG as a guide for MadMapper.

STEP#9
Load After Effects.
Import the PSD file as a composition.
This will make a new composition in After Effects of the size of the PSD file, retaining all the layers.

STEP#10
In After Effects, we now have a bunch of layers.
The architectural lines and the black layer will be useless, so turn them off.
The building is separated in two layers.
Since we want to process the whole building at one, we can group these two layers.
Select them both and go to Layers/Pre-compose. Give them a name, such as “building”

STEP#11
Now let’s make some processing on the building picture.
Here I’ve added a Levels effect, to give some contrast to the photo.

STEP#12
Add a few effects to give a Glowing look to the building.
I’ve added:
– a Find Edges filter, to give a pseudo wireframe look
– a Desaturate filter, to turn the image into grayscale
– a Posterize effect, to reduce the number of shades
– a final Glow filter

STEP#13
Adjust all the filters to get the look you’re after.
Remeber we want to map a Glowing-Scan, so now we’re on the Glowing part.
Here’s my final composite:

STEP#14
Time to setup the scanning part of our mapping.
For this I created a rectangular mask (iclick the icon on top)
that I will animate horizontally.
In the Timeline, adjust the feathering of the mask, to smooth out its outlines.

The mask should look like this:

STEP#15
Animate the mask:
first, move the mask out of the picture stage, to the left, so that the composition is all black:

Then, in the timeline, go to frame 000 (the beginning), and click the little Chronometer icon next to the Mask Path entry.
This will enable the automatic keyframing mode of After Effects.
Each time you’ll move the mask, a keyframe will be created, so you can animate things with just a few clicks.

In the timeline, scrub to the end, at the last frame.
Then move the mask on the other side of the composition.

Keyframes are automatically created, at the beginning and at the end of the timeline.
This way we created an animation.
Note that I have 150 frames in my composition.

Eventually, you can click Play to preview your animation of a Glowing-Scan.

If you jump to the middle of your animation (frame 75), the mask should be in the middle of the picture.
Note that I’ve also animated the mask feathering. Feel free to add some more effects if you’re confident
at using After Effects.

STEP#16
Now that our Glowing-Scan effect is set up and ready, we need to render it into a QuickTime movie. Add the composition to the render queue.

In the Output Module, under the compression settings, be sure to set the codec to Quicktime Photo-JPEG, Spatial Quality to 85.
These are optimal settings for replay in MadMapper or Modul8.
Since I don’t have colors, I’ve also set the color depth to Grayscale, in order to save disk space and reduce memory usage.

Select a name (I’ve chosen afx_out.mov) and Render the file (hit the Render button).

STEP#17
Close After Effects and open up MadMapper.
Now we’ll load both our Flattened JPEG we created in STEP#8 and our Quicktime Movie we just rendered.
Drag and Drop both files into the utility column on the right side of MadMapper.
Both files should now be listed, one under the Images section, the other under the Movies section.
For now, double click on the flattened JPEG. It should automatically appear in the Input view of MadMapper.

STEP#18
Now we can load up another picture of the building in the preview output in order to test the mapping features of MadMapper.
If we were to be on location of the real building, we could skip this step and work directly on the physical architecture.
However, for this tutorial, we’ll work on a background picture, which will just simulate the projector’point of view.
Note that the photo is taken from another point of view of the initial photo we used in AfterEffects and Photoshop. To load a background picture, go to the menu bar, and select: Views | Change Preview Background.

STEP#19
Go to the Surface tab of the utility column in MadMapper (second icon) and Create a Quad primitive.

STEP#20
Maximize the preview output. Go to the menu and select: Views | Ouput Preview or click the corresponding icon.
Adjust the corners of the Quad to match the perspective of the Background image.
Here you’ll find the Architectural Lines we drew in Photoshop quite useful,
as they allow for better placement and deformation of the Quad.
Eventually you can modify the Quad’s opacity to see the underlying background.
Try to match the outer contours as much as possible, but DON’T PANIC if the mapping is not perfectly matching. We’ll fine tune it in the next step. Here, the contours are more or less ok, but the center is offset.

STEP#21
Once globally positioned, enable the Mesh Warping of the Quad, and add some subdivisions.
Now select the center handles and move them to match the mapping more precisely. Try to preserve the straight lines.

STEP#22
Now go back to the Media tab, and double click on your freshly rendered After Effects movie.
This will play the movie over the background, showing you the effect we’re after (mmmm).
The perspective should match.

STEP#23
To prevent any accidental projection on the side of the building, we can use a few masks.
Go back to the Surface tab, click the mask icon. Note that the cursor will change to a small crosshair, and that the Creation icon is enabled:

Click some points in the Output Preview to make a mask.
When finished with your current mask shape, press Return to finish the mask.

At any time, fine tune the mask by selecting selecting it and enabling the edit mode by pressing the edit button:

When this mode is enabled, you can add points to the shape by double clicking on an edge,
and remove points by selecting one and pressing the Delete key.

Continue adding a few more masks.

STEP#23
Once you have finished adding more masks, your final Output Preview shold look like this:

Congratulations! You’ve just finished your mapping setup!
Now feel free to go back to After Effects and make some more complicated footage.

Here’s what the procedure looked like on the real building: