About Aspect Ratio and Non-Square Pixels

Shake has several controls in the Global parameters to help you work with non-square pixel images. These images are typically video images, or anamorphic film images. Different controls are used for the two types, due to the nature of the data that is manipulated.

For video, the primary concern is the distinction of the fields from each other, so the distortion is corrected by extending the image in the X direction and not the sensitive Y direction. For anamorphic film plates, the primary concern is the amount of data be calculated, so the image is squeezed in Y, reducing the overall frame size for better interactivity. This not only corrects the distortion, but also of speeds interactive renders by a factor of two.

You can find sample images in doc/pix/aspect to test the following discussion.

When you correct non-square pixel images, you need to know the aspect ratio of the image for transformations, and corrections to the viewing process so you can see the image without distortion. For the discussion of different aspect ratios, film anamorphic plates are used to illustrate how to work with such frames. Since the squeeze is the most drastic, the image serves as the best example. Although the solution is specifically for film plates, and you should use a slightly different solution for video images, the principles and problems are similar.

The anamorphic process creates film frames that, when projected, offer extremely wide images. This is done by first filming the scene with a special lens that squeezes the incoming image by two only in the X direction so the scene fits on the physical piece of film. Everything is very thin on the physical negative. When the film is projected in the theater, a reverse lens is applied that expands the image by two on the X axis, and returns image to its very wide format. It is therefore important to realize that the widescreen data only exists in front of the lens when filming, and on the projection screen. Usually at all points in between, you are ideally working with the squeezed image. This is also a fundamental principle when compositing squeezed elements – the ideal image is never scaled, but you still need to see the results as unsqueezed. Shake has a toolset to help you meet this criteria.

If you load the image doc/pix/aspect/anamorphic_2_1.iff, you see a low–resolution example of an anamorphic frame. The image resolution is 914x778, or half of a standard 1828x1556 anamorphic plate. You can see from the shape of the circle that the image is squeezed in X:





Properly Viewing Squeezed Images

There are two general ways to view the image in its unsqueezed proportions. You can either change the resolution of the image with a Zoom or Resize, or adjust the Viewer aspect ratio or script proxyRatio. The first choice requires you to zoom the image down by two in Y (or up by two in X), do the compositing, and then zoom it back to its squeezed proportions. This requires you to scale the image down and then up, which has an inherent loss of quality. Therefore, the second choice to modify a Viewer aspect ratio or a script proxyRatio, is more appealing. The script proxyRatio is better for film elements, and the Viewer aspect ratio is better for video elements.

So, for this anamorphic film plate, open the useProxy subtree and enter a proxyRatio of .5, to correct the squeezed element:





Function Aspect Ratio and the defaultAspect Parameter

Certain functions need to be aware of aspect ratio, specifically function dealing with circles or rotation. For example, if you apply a Rotate node on an anamorphic plate, the image is distorted.

 

The Rotate node has an aspectRatio parameter. Set the parameter to .5, and the rotation is no longer distorted:

 

The RGrad node is backwards from the other nodes (Go figure). The aspectRatio for this should be 1/defaultAspect (which is what it uses as its creation rule). Here, an RGrad with an aspectRatio of 1 is composited in:

 

Since it is distorted, change the aspectRatio of the RGrad to 2 and the world is beautiful:

 

Automatic Setting of the aspectRatio. A helpful parameter is the Global defaultAspect in the format subtree. The aspectRatio parameter of Rotate and other nodes sets to this automatically when the node is created. Changing the defaultAspect does not change pre-existing nodes – it only effects nodes that are created after you set the defaultAspect.






Compositing Square Pixel Images on Squeezed Images

In this example, square.iff in the doc/pix/aspect directory represents a square pixel image, which is typical of 3D rendered images:

 

When composited over the image, there is distortion because of the proxyRatio:

 

There are two options to correct this. You can scale the X by half or increase the Y by two. The first option ensures the highest quality, but means you have to render the original CG element at twice the resolution of the second option. In this example, the image is scaled the Y by 2 with either a Transform - Scale or Zoom node:

3D Software Renders. If your software allows for it, render you scene with the proper aspect ratio. This ensures the highest quality in your composite.

 



Tuning Parameters in Squeezed Space

Aside from Rotate and RGrad, other nodes should also be tuned with a squeezed aspect ratio. Here a Blur node is applied to the image:

 

Because the default yPixel value is set to the xPixel value, you get a twice the blur on the X parameter in the squeezed space. To correct this problem, double the Y value (or halve the X value) with an expression in the yPixels parameter:

xPixels*2

The blur looks proportionately correct:





 

Rendering Squeezed Images

Once your composite is complete, reset the proxyRatio to 1, and render. Do not change any other parameters. The result image appears squeezed on the X axis, but this distortion is corrected during the film projection process in the theater.

Although you worked on the image in a squeezed state, all elements are properly positioned when the proxyRatio is returned to 1. Use of the proxy system temporarily squeezes the image down and back up, thereby maintaining the pixel data.



Handling Video Elements

Video elements also have a built-in squeeze. To make things extra tasty, each video format has its own aspect ratio. Using the proxyRatio parameter is not recommended for video elements because proxyRatio squeezes the image in Y. This almost certainly obscures your field separation. Instead, use the viewerAspectRatio parameter set to the aspect ratio of the video element. This stretches the Viewer in X, leaving the Y untouched. This also only affects the Viewer – you will have exactly the same processing time (when going to disk), and your rendered images are not affected. However, in-Viewer playback suffers slightly.

You only need to change the defaultAspect for proper rendering. Unlike using proxyRatio, you set defaultAspect to 1/YourVideoAspectRatio. For example, PAL HD uses 1.422 as its aspect ratio. therefore set viewerAspectRatio to 1.422, and defaultAspect to 1/1.422. Shake resolves the expression of 1 divided by 1.422 to become 0.703235. All other principles of image manipulation apply.

Preset Formats. The format list in the Globals tab has a list of preset formats. You can also create your own.

 



Table of Common Aspect Ratios

This is a table (hopefully to expand in the future – feel free to submit more video aspect ratios...) of common aspect ratios, and the values you should place in specific parameters. For nodes, the aspectRatio parameter is taken from the defaultAspect value at the time the node is created. It is not changed if you later change defaultAspect. Additionally, RGrad is the inverse of the other aspectRatio parameters, for example, 1/defaultAspect, which accounts for its own column in the table. Initially setting the defaultAspect guarantees that all nodes automatically get the proper aspect ratio. Finally, follow the guidelines in Customize Shake and save your Interface Settings to set default values for these parameters.See Customize - Formats for more information.

Format
a
aspect ratio
proxyRatio
viewerAspectRatio defaultAspect aspectRatio (common nodes) aspectRatio (RGrad)
2:1 Anamorphic Film 2 .5 NA .5 .5 2

4:3 NTSC D1
720x486,
720x480

.9 NA .9 1/.9 = 1.1111 1.11111 .9
16:9 NTSC 720x486 1.2 NA 1.2 1/1.2 = .83333 .8333 1.2
4:3 PAL
720x576
1.066 NA 1.066 1/1.066 =
0.938086
0.938086 1.066
16:9 PAL
720x576
1.422 NA 1.422 1/1.422 .703235 1.422