After Effects Script of the Week: pt Panorama

Thanks to Photoshop and the iPhone, creating a single, arbitrarily wide panoramic image made up of a series of still images, stitched together, has never been simpler. First you shoot the series of stills, being careful to leave overlap between each image as you pan in one direction. Then in Photoshop, the Photomerge operation, or on the iPhone, an app such as AutoStitch Panorama or 360 Panorama automatically detects the matching areas of frame and corrects for lens distortion in order to create a single, wide image.

But suppose you want to use this image as a background for an After Effects scene? In order to interact with the background just as it was shot, you ideally want it mapped cylindrically around the camera point of view, just as the original scene was shot 360 degrees around a single pivot point. And setting that up is a pain, because After Effects doesn’t provide any easy means to do it.

In order to set up this type of scene with pt Panorama, all you need is the source panoramic image and a composition to contain it; that comp should be your output frame aspect of 16:9 or whatever you’ll display at. This script is a one-button solution; select the source image and click the Make Panorama button, and you see the result shown in the figures.

You have options as well. If the source image was less than 360 degrees, you can set that, along with the number of sides (default 16) used to create the mock cylinder (made up of flat planes, since After Effects CS5.5 doesn’t provide 3D objects). It’s assumed by default that you don’t want lights or shadows, since this is an already-lit set of 2d images, but you can override that as well.

To make use of the result, it’s most effective to leave your camera in place at the center of the cylinder and adjust the Zoom control to frame the background scene. You can then pan the camera around the scene from that point, with any additional 3D layers arrayed in front of it: text, graphics, or even a 3D extruded object you create with Digieffects Camera Mapper.

Mark Christiansen

Mark Christiansen

Author of After Effects Compositing series at; founder of New Scribbler LLC, developer of Cinefex for iPad; Adobe Press author, VFX artist on major motion pictures including Avatar and Pirates of the Caribbean: At World’s End