• No results found

Naming file sequences

There are two ways to render moving images. one is by rendering a single file that holds all the frames, as is the case with QuickTime and AVI. The other, which is pre-ferred for various reasons, is the file sequence method. In this method, you render a file per frame. The way you keep the files in order is by giving every file a number that corresponds to the number of the frame it represents. This creates a file called some-thing like myrender.0001.jpg, representing the first frame of a sequence. Frame 22 would be myrender.0022.jpg. And so on.

When you tell Nuke to write a file sequence, you need to do four things:

n Give the file a name. Anything will do.

n Give the file a frame padding structure—as in: How many digits will be used to count the frames? There are two ways to tell Nuke how to format numbers. The first is by using the # symbol, one for each digit. So #### means four digits, and

####### means seven digits. The second method is %04d, where 04 means the number of digits to use—in this case, four. If you want two digits, you write %02d.

I find the second method easier to decipher. Just by looking at %07d you can tell that you want seven digits. Using the other method, you actually have to count.

Please note that you have to add frame padding yourself. Nuke won’t do this for you. Nuke uses the # symbol by default when displaying file sequence names.

n Give your file an extension such as: png, tif, jpg, cin, dpx, iff, or exr (there are more to choose from).

n Separate these three parts of the file name with dots (periods).

The first bit can be anything you like, though I recommend not having any spaces in the name due to Python scripts, which have a tendency to not like spaces (you can use an underscore if you need a space). The second bit needs to be defined in one of the ways mentioned previously, either the %04d option, or the #### option. The last bit is the extension to the file type you want to render, such as: jpg, exr, sgi, tif, etc.

An example of a file name, then, is filename.%04d.png, or file_name.####.jpg.

To render a single file, such as a QuickTime file, simply give the file a name and the extension .mov. No frame padding is necessary.

1 . In the field at the bottom, at the end of your path, add the name of your file sequence. Use: doll_v01.####.tif. Don’t forget the dots and the v01 (FigUrE 2.34).

2 . Click Save.

You now have the path and file name under the File property. You might have noticed that the Write1 Properties panel changed a little. It now accommodates a property called Compression, which is, at the moment, set to a value called deflate.

Let’s change the compression settings.

3 . Choose LZW from the Compression drop-down menu (FigUrE 2.35).

LZW is a good, lossless compressor that’s part of the TIFF architecture. Lossless means that, although the file size will be smaller, no quality is lost in the process.

In contrast, JPG uses lossy compression.

You are now ready to render using the Render button on Write1’s Properties panel (FigUrE 2.36). You can also use the Render All and Render Selected commands in the Render menu in the menu bar.

FIGURE 2 .35 Changing the Compression property to LZW.

FIGURE 2 .36 The render button is the quickest way to start a render.

FIGURE 2 .34 Enter the name of your file sequence at the end of the file’s path.

Call me superstitious, but even with the autosave functionality I still like to save on occasion, and just before a render is one of those occasions.

4 . Save your Nuke script by pressing Ctrl/Cmd-S.

5 . Click the Render button.

6 . In the Render panel that displays, click oK.

The Render panel lets you define a range to render. The default setting is usually fine.

The render starts. A Progress Bar panel displays what frame is being rendered and how many are left to go (FigUrE 2.37).

You now need to wait until the render is finished. once it is, you probably want to look at the result of your render. Let’s do that.

If you are running the PLE version of Nuke, please use the following steps. (Even if you are not running the PLE, read this section as you can use this method too—other-wise you should pick up from step 11.)

Every Write node can double as a Read node. If the Read File check box is selected the Write node will load the file that’s written in its File property (FigUrE 2.38).

FIGURE 2 .38 This little check box turns the Write node into a read node.

7 . In Write1’s Properties panel, click the Read File check box to turn it on.

Your Write node should now look like the one in FigUrE 2.39 (next page). It now has a thumbnail like a Read node does.

FIGURE 2 .37 The pop up in the middle of the screen, which I find annoying because it hides the image.

FIGURE 2 .39 The Write node now has a thumbnail.

8 . Make sure you are viewing Write1 in the Viewer and then click the Play button to play forward. When you’re finished, remember to click the Stop button.

9 . Also, when you’re finished, uncheck Read File.

For those who have a licensed copy of Nuke, perform the next couple of steps.

10 . Select Write1 and press Alt/option-F on your keyboard to load Write1 into Frame-cycler. In the Flipbook panel that opens, click oK.

This should happen very fast. When loading a Write node into Framecycler, Nuke doesn’t render a flipbook, but rather looks at the File property for a file name and path and loads that instead.

11 . Press Play and watch your work. When you are finished, quit Framecycler.

So, not too shabby. You still have a little work to do. If you look carefully, you might notice that the doll’s feet are actually on top of the front edge of the artist’s toolbox instead of behind it, so the doll does not yet appear to be inside the toolbox. Another problem is that around halfway through the shot the background darkens, something that you should mirror in the doll. Let’s take care of the doll’s feet first.

tip All nodes can have thumbnails. You can turn them on and off by selecting a node and using the Alt/option-P hot key.

DeLViNg DeepeR iNTo The meRge NoDe

To cut the doll’s feet so the doll appears to be behind the front edge of the artist’s toolbox, you need another matte. You will learn to create mattes in Chapter 6. Until then, you will read the matte as an image from the disk.

1 . While hovering over the DAG, press R on the keyboard to create another Read node.

2 . In the File Browser that opens, navigate to the chapter02 folder and double-click mask.tif to import that file.

3 . Select Read3 and press 1 on the keyboard to view this image in the Viewer.

What you see in the Viewer should be the same as FigUrE 2.40. You now have a red shape at the bottom of the image. Mattes are usually white, not red. How will you use this? Do you need to key it perhaps? Let’s take a better look at this image.

FIGURE 2 .40 The matte image looks like this.

4 . While hovering the mouse pointer over the DAG, press the R key to view the red channel (FigUrE 2.41).

FIGURE 2 .41 Viewing just the red channel.

This is what I usually expect a matte to look like: white on black. Let’s see what the other channels look like.

5 . While hovering the mouse pointer over the DAG, press the B key to view the blue channel, then the G key to view the green channel, then the A key to view the alpha channel, and finally the A key again to view the RGB channels.

Did you notice that all the other channels are black? This image was saved like this to conserve space. There is only information in one channel, the red channel, rather than having the same information in all four channels, which adds nothing but a big-ger file. Just remember that your matte is in the red channel.

The Merge node’s default layering operation is over, which places one image over another. But Merge holds many more layering operations. You will look at a few throughout this book.

Now you will use another Merge node to cut a hole in the doll’s branch before it gets composited over the background. Because you want to cut this hole after the doll has been repositioned—but before the composite takes place—place the new Merge node between Transform1 and Merge1.

6 . Select Read3 and press M on the keyboard to create another Merge node (FigUrE 2.42).

FIGURE 2 .42 The newly cre-ated Merge2 node’s A input is connected to read3.

Merge2 has been created with its A input connected to Read3. You need to connect Merge2’s B input to Transform1 and Merge2’s output to Merge1’s A input. You can do this in one step.

7 . Drag Merge2 on top of the pipe in between Transform1 and Merge1, and when the pipe turns white, as in FigUrE 2.43, release the mouse button.

Look at Merge2’s Properties panel (FigUrE 2.44). It shows that the operation property is still over. You need to change that to something that uses the A input to punch a hole in the B input.

FIGURE 2 .44 The Operation drop-down menu.

The Stencil operation does exactly that. It creates a hole in the B input where the alpha channel of the A input is white. Let’s change the operation to Stencil.

8 . Change Merge2’s operation property from over to Stencil.

9 . Select Merge1 and press 1 on the keyboard to view it.

Look at the image in the Viewer (FigUrE 2.45). It appears unchanged. The doll’s feet are still visible in front of the artist’s toolbox. This is because the Stencil operation uses the A input’s alpha channel, but your matte is in the red channel. To solve this, move the red channel into the alpha channel using a node called Shuffle.

FIGURE 2 .45 The doll’s feet are still in front.

FIGURE 2 .43 Using this method, you can insert a node to an existing pipe.