Compositing is the process of mixing multiple visual assets to create a single image or sequence of images. By this definition, you may notice that technically Blender's VSE qualifies as a sort of compositor because you can stack strips over each other in channels and blend them together with effects and transitions. Although this statement is true, the VSE is nowhere near as powerful as the Node Compositor is for mixing videos, images, and other graphics together.
As designed, the VSE is intended for working with multiple shots, scenes, images, or clips of video. It's also meant to play back in real time (or as near to that as possible). In contrast, the Compositor is intended for working with a single shot, and it's most certainly not meant for working in real time. There is a little bit of overlap in the functionality of these two parts of Blender, but depending on the task at hand, one is more suitable than the other.
What makes the Node Compositor so powerful? Well, it's in the name: nodes. One of the best ways to understand the power of nodes is to imagine an assembly line. In an assembly line, each step in the process depends on the step immediately preceding it and feeds directly into the following step. This methodology is similar to the layer-based approach used in many image manipulation programs like Photoshop and GIMP. Each layer has exactly one input from the previous layer and one output to the following one. Figure 15-5 illustrates this idea.
That approach works well, but you can enhance the assembly line a bit. Say that some steps produce parts that can go to more than one subsequent step, and that other steps can take parts from two or more earlier steps and make something new. And take it a bit farther by saying that you can duplicate groups of these steps and integrate them easily to other parts of the line. You then have an assembly network like that depicted in Figure 15-6. This networklike approach is what you can do with nodes.
Before taking full advantages of nodes, it's worthwhile to take a quick moment and understand what it means to render in passes. Assume for a moment that you animated a character walking into a room and falling down. The room is pretty detailed, so it takes a fairly long time for your computer to render each frame. However, because the camera doesn't move, you can really render the room just once. So if you render your character with a transparent background, you can superimpose the character on just the still image of the room, effectively cutting your render time in half (or less)!
That's the basics of rendering in passes. The preceding example had two passes, one for the room and one for the character. However, you can have many more passes with more detailed content. For example, if you want to, you can have a render pass that consists of just the shadows in the image. You can take that pass and adjust it to make all the shadows slightly blue. Or you can isolate a character while she's walking through a gray, blurry scene.
Another thing to understand for compositing 3D scenes is the concept of Z-depth. Basically, Z-depth is the representation of the distance that an object is from the camera, along the camera's local Z-axis. Z-depth is used quite often in compositing. The compositor can use this Z-depth to make an object look like it fits in a scene even though it was never rendered with it.
To do render passes in Blender, you use render layers. It's important to make a distinction here between Blender's regular layer system and render layers. Although render layers do use Blender's layer system, they are separate things. Basically, you can decide arbitrarily which Blender layers you'd like to include or exclude from any of the render layers you create. All the controls for render layers are in the Layers panel in Render Properties. Figure 15-7 shows the Layers panel
At the top of the Layers panel is a list box containing all the render layers in your scene. By default, there's only one, named 1 RenderLayer. Beneath the list box is a text field where you can enter or change the name for a selected render layer. The next section features three blocks of Blender layers. The first block of these layers shows the scene layers; the ones that are going to be sent actively to the renderer.
The next set of Blender layer buttons determine which Blender layers actually belong in this render layer. For example, if you're creating a render layer for background characters and you have all your background characters on layers 3 and 4, you Shift+left-click those layers in this block.
The third set of Blender layer buttons are mask layers. The objects in these layers explicitly block what's rendered in this render layer, effectively masking them out. You typically use these layer buttons for more advanced compositing scenarios.
The series of check boxes that fill the majority of the Layers panel are where the real magic and power of render layers lie. The first set of check boxes specify which pipeline products to deliver, or include (hence the label), to the renderer as input. These pipeline products refer to major renderable elements of this render layer that are seen by the renderer. If you disable Halo, for example, no halo materials are sent to the renderer. Basically, they're omitted. You can use these check boxes in complex scenes to turn off pipeline features you don't need in an effort to shorten your render times.
Here is a brief description of some of the more useful pipeline features:
Underneath the Include check boxes is a set of options that control which passes are sent to the render layer. These passes are most useful when used in the Node Compositor because essentially they make compositing so interesting and fun. Here are some of the most useful passes:
After you set up your render layers the way you like, you're ready to work in the Node Compositor. As with the VSE, Blender ships with a default screen layout for compositing, appropriately named Compositing. You can access the Compositing layout from the Screens datablock at the top of the window or by pressing Ctrl+← once from the Default screen layout. By default, Blender puts you in the Node Editor for compositing, which is exactly where you want to be. The other node editors are for materials and textures and are for more advanced work.
By itself, the Node Editor looks pretty stark and boring, like a lame 2D version of the 3D View. However, left-click the Use Nodes check box in the header, and you see a screen layout that looks similar to the one shown in Figure 15-8.
Blender starts by presenting you with two nodes, one input and one output. You can quickly tell which is which by looking at the location of the connection points on each node. The left node labeled Render Layers has connection points on the right side of it. The location of these connection points means that it can serve only as an input to other nodes and can't receive any additional data, so it's an input node. It adds information to the node network. In contrast, the node on the right, labeled Composite, is an output node because it has no connection points on its right edge, meaning it can't feed information to other nodes. Essentially, it's the end of the line, the result. In fact, when you render by using the Node Compositor, the Composite node is the final output that gets displayed when Blender renders.
I personally prefer to see the progress of my node network as I'm working, without having to constantly refer back to another editor for the results of my work. Fortunately, Blender can facilitate this workflow with another sort of output node: the Viewer node.
To add a new node, position your mouse cursor in the Node Editor and press Shift+A. You see a variety of options. For now, navigate to OutputViewer to create a new output node labeled Viewer.
If the Render Layer input node was selected when you added the Viewer node, Blender automatically creates a connection, also called a noodle, between the two nodes. Noodles are drawn between the circular connection points, or sockets, on each node. If the noodle wasn't created for you, you can add it by left-clicking the yellow Image socket on the Render Layer node and dragging your mouse cursor to the corresponding yellow socket on the Viewer node.
However, making this connection doesn't seem to do much. You need to take three more steps:
A black box loads in the background of the compositor. (Don't worry; it's supposed to happen, I promise.)
When the render is complete and you return to the Blender interface by pressing F11, the empty black box has been magically replaced with the results of your render. Now anything that feeds into this Viewer node is instantly displayed in the background of the compositor.
This setup is the way I typically like to work when compositing. In fact, I often take it one step farther and press Shift+spacebar to maximize the Node Editor to the full window size. This way, you can take full advantage of your entire screen while compositing.
If you find that the backdrop gets in your way, you can disable it by left-clicking the Backdrop check box in the Node Editor's header, or you can move it around in the compositor by Alt+middle-clicking in the editor and dragging the image around. Also, you can get more space by middle-clicking in the compositor and dragging the entire node network around, or by using your scroll wheel to zoom in and out on the nodes. As of the Blender 2.5 series, you also have the ability to scale the backdrop image by using the V (zoom out) and Alt+V (zoom in) hotkeys. Table 15-3 shows most of the frequently used mouse actions in the Node Editor.
Mouse Action | Description |
Right-click | Select a node. |
Shift+right-click | Select multiple nodes. |
Middle-click | Pan compositor work area. |
Alt+middle-click | Move backdrop image. |
Ctrl+middle-click | Zoom compositor work area. |
Scroll wheel | Zoom compositor work area. |
Left-click (on a node) | Select a node. Click and drag to move the node around. |
Left-click (on a socket) | Attach or detach a noodle to/from the socket you click on. Click and drag to the socket you want to connect to. |
Left-click+drag the bottom right corner of a node | Resize the node. |
Left-click+drag in the compositor workspace | Create a box. Any noodles in the box's area are deleted, leaving just nodes. Think of it as cutting noodles. |
Ctrl+left-click+drag in the compositor workspace Shift+Ctrl+left-click a node |
Lasso select. Connect the active Viewer node to the output of the clicked node. Continuous Shift+Ctrl+left-clicks iterate through the multiple outputs of the node. |
At the top of each node are four icons: the triangle on the left and the Plus (+), “equal,” and sphere icons on the right. Following is a description of what each button (shown in Figure 15-9) does:
For the most part, editing nodes in Blender conforms to the same user interface behavior that's in the rest of the program. You select nodes by right-clicking, you can grab and move nodes by pressing G, and you can border select multiple nodes by pressing B. Of course, a few differences pertain specifically to the Node Editor. Table 15-4 shows the most common hotkeys used in Node Editor.
When connecting nodes, pay attention to the colors of the sockets. The sockets on each node come in one of three different colors, and each one has a specific meaning for the type of information that is either sent or expected from the node. The colors and their meanings are as follows:
As Table 15-4 shows, you can also group nodes together. The ability to make a group of nodes is actually one of the really powerful features of the Node Editor. You can border select a complex section of your node network and press Ctrl+G to quickly make a group out of it. Grouping nodes has a few really nice benefits. First of all, grouping can simplify the look of your node network so that it's not a huge mess of noodles (spaghetti!). More than simplification, though, node groups are a great organizational tool. Because you can name groups like any other node, you can group sections of your network that serve a specific purpose. For example, you can have a blurry background group and a color-corrected character group.
But wait, there's more! (Do I sound like a car salesman yet?) When you create a group, it's added automatically to the Group menu when you go to add a new node (Shift+AGroup). To understand the benefit of being able to add groups, imagine that you created a really cool network that gives foreground elements a totally sweet glow effect. If you make a group out of that network, you can now instantly apply that glow to other parts of your scene or scenes in other .blend files. Go ahead: Try it and tell me that's not cool — you can't do it!
When working with nodes, it's a good idea to have the network flow from the left to the right. Wherever possible, you want to avoid creating situations where you feed a node's output back to one of the nodes that gives it input. This feedback loop is called a cyclic connection. If you've ever heard the painfully loud feedback noise that happens when you place a microphone too close to a speaker, you have an idea of why a cyclic connection is a bad idea.
Blender has quite an extensive list of nodes that you can add to your network. In fact, it seems like with every release of Blender, more and more incredible node types are added to the compositor. Many nodes have a Fac, or factor, value that you can usually either set with a value from another node or explicitly set by typing. Values less than 1 make the node have less influence, while values greater than 1 make the node have more influence than usual over the image.
The input nodes are one of the two most important node types in the Node Compositor. If your node network doesn't have any inputs, you don't have a composite. Figure 15-10 shows each of these nodes side by side.
Input nodes are one of the two most important node types in Blender. As you may have guessed, the Output nodes are the other important node types, for a similar reason. If you don't have an output node, Blender doesn't know what to save when it renders. The following are the two most-used Output nodes:
The Color nodes have an enormous influence over the look of the final output. These nodes directly affect how colors appear, mix, and balance in an image. And because an image is basically just a bunch of colors arranged in a specific pattern, you can understand why these nodes have so much control. Figure 15-11 shows some of the most commonly used Color nodes. Following are descriptions of each node type:
Vector nodes use 3D data from your scene to influence the look of your final 2D image. The usage of these nodes tends to be a bit advanced, but they allow you to do things like change the lighting in a scene or even change the speed that objects move through the scene . . . all without rerendering! If you render to an image format that understands render passes, like the very cool OpenEXR format (more on this topic in the next section), and you include vector and normal passes, these nodes can be a huge timesaver.
Filter nodes can drastically change the look of an image and are probably the No. 1 way to fake any effect in an image. These nodes actually process the pixels in an image and can do things like put thick black lines around an object, give the image a variety of customized blurs, or make bright parts of the image glow. Figure 15-12 shows some of the most useful Filter nodes:
These handy little utility nodes have a variety of purposes, including converting one set of data to another and ripping apart or recombining elements from a rendered image. The Color Ramp and ID Mask nodes in particular get used quite a bit. The Color Ramp node is great for helping visualizing or revisualizing numerical values on a scale. For example, the only way to get a good sense of what the Z-depth of an image looks like is to map Z values along a manageable scale and then feed that to a white-to-black color ramp, as shown in Figure 15-13.
The ID Mask node is handy because it allows you to isolate an object even more specifically than with layers and render layers. Assume that you want to apply the Glare node to a ball that your character is holding. If the scene is complex enough, it doesn't really make a lot of sense to give that ball a layer all by itself. So you can give the object a Pass Index value in the Relations panel of Object Properties. Then by using the ID Mask node, you can isolate just that ball and make it all shiny.
The Matte nodes are specifically tailored for using color information from an image as a way of isolating certain parts of it. Matting is referred to as keying because you pick the main color, or key color, to represent transparency. Keying is the fundamental basis for those cool bluescreen or greenscreen effects used in movies. The filmmaker shoots the action over a blue or green screen (blue is used for analog film, whereas green is typically used for digital footage), and a compositor removes the blue or green and replaces it with other footage or something built in 3D.
The Distort nodes typically do general-purpose image manipulation operations like Translate, Rotate, Scale, Flip, or Crop.
Want to do that spinning newspaper effect you see in old movies? Wire an image of a newspaper and the Time node to the Rotate and Flip nodes, and you've got it! However, three special Distort nodes are worth talking more about: Displace, Map UV, and Lens Distortion. Figure 15-14 shows each of these nodes.
When you press Ctrl+G to create a node group, that group is placed in this menu. When you group a set of nodes, you instantly have the ability to apply that network to other parts of your composition. Also, grouping gives you the ability to share node networks between .blend files. When you append or link a node group from another file, it shows up in this menu. There's more on grouping in this chapter in the section “Grouping nodes together.”
Whenever you have the opportunity, name everything you create. Unique names are especially important for groups because they're automatically added to the Group menu. Using names that make sense makes choosing the right node group a lot easier. You can always rename node groups from the Properties region of the Node Editor (N).
If you're using the Node Compositor, you already know all the basic steps for getting a rendered image out of it. Of course, if you skipped straight to this section, here's the quick version: Make sure that the Compositing check box in the Post Processing panel of Render Properties is enabled.
That said, you need to know one other thing about rendering from the Compositor. Say that you're working on a larger production and want to save your render passes to an external file format so that either you or another compositor can work on it later without rerendering the whole scene. You'd have to save your renders to a file format that understands render layers and render passes. That format is the venerable OpenEXR file format, developed and gifted to the world by the cool people at Industrial Light & Magic.
Now I know what you're thinking, “Using this format is as easy as setting up my render layers and then choosing OpenEXR from the menu in the Output panel of Render Properties.” You're actually two-thirds correct. You do set up your render layers and you do go to the Output panel. However, choosing OpenEXR saves only the final composite output (not the layers or passes) in an OpenEXR file (extension .exr). In order to get layers and passes, you should instead choose MultiLayer. With this format, you get an OpenEXR file that has all the layer and pass information stored with it.
Pay close attention to your hard drive space when you choose to render to OpenEXR with all your layers and passes embedded. Keeping all your render layers and passes is a great way to tweak and make adjustments after rendering. However, the file size for each individual .exr file can be huge. Whereas an HD frame in PNG format may be only a couple hundred kilobytes, an OpenEXR file on the same single frame with all the passes enabled may be well over 100 megabytes — yes, megabytes. And if your animation has a length in minutes, that 100 megabytes per frame starts taking up space quickly. So make sure that you do test saves to get a good benchmark for the file size and see that you have enough hard drive space to store all those frames.