Blender 3D: Noob to Pro/Compositing

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Compositing is the combination of multiple sources of visual input into a single, final image. This is common functionality in expensive, commercial video editors. Some of these (such as Adobe After Effects) use a layer-based compositing engine. Others (such as Apple Shake, The Foundry's Nuke, and eyeon fusion) use a more powerful node-based compositing engine. Blender features a very advanced and powerful compositing engine through the use of the Nodes Editor window. Although the challenge of learning to use nodes may seem intimidating, it can be very rewarding because of the professional-looking final products that can be easily produced.

Compositing Example[edit | edit source]

In this tutorial, we will see how compositing, combined with render layers, can produce some effects that are difficult or impossible to achieve just by straight rendering of a 3D model.

Start with a new Blender document. For a change, let’s use the default cube. Assign it a new material. Keep all the settings at default, but in the Shading panel, set the Emit value to 1.0 and give it an interesting diffuse colour.

Go to the Render context , look for the Post Processing panel, and check the “Edge” box. This will draw a black outline around all objects. If you hit  F12  to render right now, you should see something like this:

So far, not very exciting. Now go to the Render Layers context . You should see there is already an initial default layer called “RenderLayer”. If you look in its Layer panel, you should see checkboxes indicating all the passes of the rendering process to include in this layer. Look for the “Edge” checkbox, and uncheck that. Now click the  +  icon next to the list of layers, to add a new layer. Look in its Layer panel, make sure “Edge” is checked, and uncheck all the other checkboxes in the “Include:” section.

Now open up a Node Editor window, and look for the three icons to the right of the menus, showing what kind of nodes to edit: ; click on the middle one (if it’s not already selected) to enable compositing nodes. Now check the “Use Nodes” box to the right of it. You should now see the initial default node setup, with a single Render Layers node feeding the initial default render layer directly to the output:

Add another Render Layers node. From its layer popup menu, select the second render layer you created, the one producing the edge outlines (which should be called “RenderLayer.001” if you didn’t change its name).

Now, add a Blur node (Filter submenu of the Add menu). The default Gaussian kind of blur will do fine. Put nonzero values (e.g. 1) into the X and Y fields (otherwise the blur Size value will have no effect). Give it a Size value of, say, 20. Connect the Image output of the first render layer (the one doing everything except the edge outlines) into its Image input.

Add an Alpha Over node (from the Color submenu of the Add menu). Feed the Image output from the Blur node into its upper image input, and the Image output from the second render layer (the one producing the outline edges) into its lower image input. Leave the Factor at its default 1.0. Connect the Image output of this Alpha Over node to the Image input of the Composite node (the final output).

When you are done, check that your connections look like this (remember, the exact positions of the nodes are unimportant, except for clarity; what’s important is the connections between them):

The effect of this is to blur the rendering of the cube (apart from the edge outline), and then put the edge outline back on top of it. If you hit  F12  to render now, you should see something like this:

Things to Try[edit | edit source]

What happens if you put different values into the X and Y fields of the Blur node? Try making the X value different from the Y value.

What happens if you get the inputs the wrong way round into the Alpha Over node?

Try the other blur types available from the menu in the Blur node.

Other Tutorials[edit | edit source]

Composite Nodes Video Tutorial (2.49b):

Vector Blur Tutorial (2.49b):

Depth of Field (DOF) Using Composite Nodes (2.49b):