Beruflich Dokumente
Kultur Dokumente
By Colin Litster
Why Composite?
You have reached the point where you have created a good mesh and designed a gre
at material to shade it. You have applied lights to illuminate your scene for ma
ximum effect. Surely, you only need to press the render button to be finished!
Although your render might seem to be done, in a real production environment you
would almost certainly have to color correct or composite the render with a pre
-created background, or possibly even put it together with several different ren
ders, building a final image in layers. While it is possible to add all the pote
ntial elements of a completely finished scene into a single render, it is an ine
fficient and time consuming approach to a production.
Figure RCT.1: A stormy ocean scene composited from several images.
The process of combining different elements into a single image is called
ting.
composi
Blender has a Compositor and post-production facility built in. It can be used t
o finely control the look of the finished render while drastically reducing rend
er times in animations. More importantly, it gives you complete control over the
end result.
Figure RCT.02: The only difference between the images is that the one on the lef
t is a raw render, while the one on the right has gone through the compositor.
The Production Pipeline
You probably have heard this phrase in relation to the motion picture or graphic
still production industry. It refers to the workflow that begins with the organ
ization of 3D objects, materials, textures, scenes and animation, proceeds throu
gh the rendering of these elements, and ends up by combining all of these assets
into finished images.
Blender gives artists the ability to do all of these things in one package, whil
e allowing the integration of content from other sources and giving the opportun
ity to produce images and files that are useful in the scheme of a larger pipeli
ne.
While a complete understanding of the Blender render pipeline can help you make
even more efficient use of the Compositor, you can start to use this versatile t
ool with only a little knowledge. In this chapter, we will introduce compositing
techniques to produce effects that would not be possible otherwise. With only a
few tools, you can subtly or even radically improve your renders.
Rather than bog you down with too much detail at this early stage, we'll have yo
u do a simple composite effect to learn some core facts about the system. Later,
you'll do a more complex exercise that teaches more about individual node types
, as well as some common techniques like bloom, color correction and vector-base
d motion blur. These later exercises will also show how the composite system can
save you considerable time in the render process.
A Beginning Compositor Exercise
Let s use the Compositor to apply a sort of background shadow to a simple mesh mod
el.
Why did it show this result? The Alpha output socket on the RenderLayer node con
tains the Alpha channel of the raw render. An Alpha channel is a grayscale image
that shows the opacity of different parts of the render: white for opaque, blac
k for completely transparent and everything in between. By connecting the Alpha
output to the Composite node s Image input, you told the Compositor to use the Alp
ha channel as the final Image.
Alpha channels (sometimes called Alpha masks, or just masks) are useful for sepa
rating and overlaying renders in the Compositor.
Now, you ll use that white, opaque area to create a shadow behind your objects. At
the moment, though, it s the wrong color. Also, as it s exactly the same size as th
e objects themselves, it would be hidden. In order to turn this mask into a shad
ow that can be seen, it will be necessary to:
1.
2.
3.
4.
5.
enlarge it slightly;
blur it;
invert its values (white for black and vice versa);
put the original render layer over the shadow; and
add some color.
If you haven t been doing so already, now would be a good time to save your work.
Enlarging a Mask
If you have used a paint package before, you may have heard of a dilate/erode or
shrink/grow filter. In short, its task is to either add or remove pixels around
a selection. The Composite nodes have such a filter, which is found, not surpri
singly, in the Add->Filters section of the spacebar toolbox.
Press the spacebar to Add a node and select Filters->Dilate/Erode.
Connect the RenderLayer Alpha output socket to the Mask input of the Dilate/Erod
e node, and connect the Mask output of the Dilate/Erode node to the Composite no
de s Image input. Set the Distance value on the Dilate/Erode node to 10.
Figure RCT.10: The Dilate/Erode node in place.
One thing you'll notice as you do this is that you do not have to re-render to s
ee the new results. That's because the render itself has already been done. You'
re just pushing things around with the compositor.
Figure RCT.11: [no text]
You should see that the alpha mask has grown somewhat from the first render. Thi
s is the effect of the Dilate/Erode filter node. If its Distance value had been
negative, the alpha mask would have shrunk. The Composite node in the editor als
o shows a small preview of the effect. While these small previews are okay for a
quick idea of what might happen, it would be better to have a larger preview wi
thout sending the node's output to the Composite result node, which should reall
y be reserved for your final composite.
Making Previews Better
Blender has a much better way to preview different stages of the compositing pro
cess.
Use the spacebar tool to Add an Output->Viewer node to your network.
Note: The Add menu on the Node Editor header also contains all of these same com
mands.
Sometimes, depending on the zoom level and size of the window, Blender creates n
ew nodes off-screen. When this happens, it is quite easy to bring them into the
view, as newly created nodes are always selected. So, pressing the G-key will al
low you to move the node into view. Alternately, you could use the scroll wheel
to zoom, and MMB drag in the window to pan until all nodes are showing. Even eas
ier, you could use the Home-key, which, as in other window types, will auto-zoom
and pan the view to show all objects.
Figure RCT.12: A good place for the viewer node.
There are a couple of things to notice here. If you created the Viewer node with
the RenderLayer node selected, it will have been automatically connected to the
Image output socket. If not, you will need to connect the RenderLayer s Image soc
ket to the one on the Viewer node. Secondly, if nothing shows up in the Viewer n
ode s preview upon connection, you may need to re-render (F12).
Although the Viewer has an image displayed, it is still rather small. Grab the b
ottom right corner of the Viewer node and drag outward to enlarge it. Make it as
large as it will go. Since you don t need the Alpha or Z input sockets for this e
xercise, click the + sign on the Viewer s header to hide them.
Figure RCT.14: A tidy Viewer node.
Let s create another Viewer node to show the Alpha channel before it runs through
the Dilate/Erode filter. You could create another viewer with the toolbox, and t
hen resize and tweak it to make it look like the one you already have, but why n
ot duplicate the existing Viewer and move it? Duplicate in the Node Editor is th
e same as in other window types: Shift-D.
Make sure the Viewer node is selected and press Shift-D. An exact copy is produc
ed and placed into Grab mode. Move it below the Dilate/Erode node.
Drag a new connection from the RenderLayer Alpha output to this new Viewer s Image
input.
Figure RCT.15: Note how multiple connectors branch out from RenderLayer s Alpha so
cket.
It is possible to have multiple connectors originate from a single output socket
. We won't go into that in detail yet, but it's good to know that it can be done
.
While useful, these viewer nodes don't seem to give any kind of better preview t
han the little images in the other nodes. Wouldn t it be great if you could make t
hese as large and detailed as a standard render window?
If you're using the composite layout file from the CD, you already have two UV/I
mage Editor windows available. If not, split one of the windows in your workspac
e (MMB on a window border, see Chapter 2), and change it to a UV/Image Editor wi
ndow.
Figure RCT.16: Setting a window to the UV/Image Editor type.
In the header of the new UV/Image Editor window, select "Viewer Node" from the p
opup menu.
Figure RCT.17: Selecting "Viewer Node."
From now on, this window will display a full resolution image of the currently a
ctive viewer node. You can zoom the view using your mouse scroll wheel and pan b
y MMB dragging.
Up until now, all renders have brought up a separate Render window. It is possib
le to direct render output to appear as a Render Result in the UV/Image Editor w
indow as well. This can be set on the Output tab in the Render buttons (F10).
Figure RCT.18: Selecting "Image Editor" for the default Render Display.
With this setup, composite structures become much easier to create. Although you
cannot even see your 3D scene directly from a screen like this, remember that c
ompositing is a post-production process. Modeling, materials, and animation will
almost certainly be completed before you start to create a compositing work flo
w.
Blurring the Mask
Back in the main example, you need to blur the alpha mask image to produce the n
ice feathered look you would like the shadow to have. There are several nodes, a
ll in the Add->Filter section, that produce blurs:
Vector Blur: A very fast method of creating motion blur for animations.
Defocus: Simulates various camera blurs for Depth of Field and other effects.
Blur: Simple image blurs, using several different methods.
As you're not using motion or trying to simulate camera effects, the basic Blur
will suffice. Add a Blur node with Add->Filter->Blur.
Connect the Dilate/Erode node's Mask output to the Image input of the new Blur n
ode. Then, connect the Blur node's Image output socket to the Image input on the
Composite node.
Note: When you attach a new connector to an input node that already has
tion, Blender may attempt to rearrange some connections for you. Often,
be useful, but sometimes (e.g. when you have an Alpha socket connected
to an Image socket) it can make the wrong choice. If this happens, you
ys delete any incorrect links by LMB dragging over the bad connectors.
a connec
this can
directly
can alwa
here are a number of ways to invert an image, and in this example we'll show you
a method that will also allow you to add some color.
Zoom out with the scroll wheel if you have to, and move the Composite node to th
e right to make room for more nodes.
RGB Curves
Add an RGB Curves node with Add->Color->RGB Curves.
Figure RCT.21: The RGB Curves node.
Place it between the Blur and Composite nodes, connecting Blur's Image output to
RGB Curves Image input. Then, connect RGB Curve's Image output to Composite's I
mage input. You should be getting the hang of building connections like this by
now.
The RGB Curves node can be quite tricky, but it is one of the most powerful and
generally useful nodes available. It provides fine control over the contrast and
color of an incoming image.
In its default state, the node shows a straight line running diagonally from bot
tom left to top right. This represents a mapping of the value from the input soc
ket to what the node sends to the output socket. The horizontal axis represents
the input color with black at the left, moving through 50% gray in the center, a
nd with white at the extreme right. The vertical axis represents the output valu
es, with black at the bottom, 50% gray halfway, and white at the top. The curve
represents how the input will be changed to produce the output. The default diag
onal line in the node is the "curve" mentioned in the node's title. Although it
doesn't look like a curve at the moment, it is.
If you were to alter the curve, the relationship between input and output color
would also change, depending on how you shape it. You can use this curve to rema
p the colors of your image so that an input of black becomes white, and white be
comes black.
Move the mouse to the bottom left-hand point of the curve and LMB drag it up as
far as it will go along the vertical axis, while keeping it flush with the left
side of the work area. By doing that, you have told the node to take any input o
f 0% (black, along the horizontal axis) and change it to an output of 100% (whit
e, along the vertical axis).
Now, LMB drag the point on the curve in the upper right of the work area the who
le way down, until it looks like this:
Figure RCT.22: The default RGB curve reversed.
Remember that if you make a mistake, you can quickly remove it with Undo (Ctrl-Z
).
The second move tells the node to change any inputs of 100% (white, along the ho
rizontal axis) into outputs of 0% (black, along the vertical axis). The line tha
t runs between the two points gives a blend between those two transformations.
The UV/Image editor render result window should update to show the inverted imag
e, which now looks a lot more like the shadow you are shooting for.
Figure RCT.23: The effects of the inverted RGB curve, shown in the Render Result
.
We will come back to the RGB Curves node later to add some color variation. Now,
though, let's place this shadow behind the original objects.
You will need to take the original render layer, with its original alpha, and pl
ace it over the node-generated shadow image. To do this, you will use the AlphaO
ver node.
Placing the RenderLayer Image Over the Shadow
Add an AlphaOver node with Add->Color->AlphaOver. You're getting a small cluster
of nodes now, and it might be useful to either zoom out or to start rearranging
things. Put the AlphaOver node between the RGB Curves and Composite nodes.
Notice how the AlphaOver node has two Image input sockets? That's because it tak
es two images and combines them into a single output. Connect the Image output o
f the RGB Curves node to the top Image input on AlphaOver. Connect the original
Image output on the RenderLayers node to the bottom Image input on AlphaOver. Fi
nally, connect the Image output from the AlphaOver node to the Image input of th
e Composite node.
Figure RCT.24: The node network with AlphaOver connected.
The UV/Image editor Render Result should update to show the objects over the top
of the shadow.
Figure RCT.25: [no text]
Compositing Issues
Before we move on to the final section of this exercise, let's take a closer loo
k at the render and composite you just achieved.
Figure RCT.25a: An ugly border around the composited objects.
The render result shows a slight blue edge around the objects. This is not reall
y a problem with the node network, but with the original render settings. The od
ds are that until now, you've been rendering everything with the default, Sky ba
ckground. In the Render buttons, the Render panel has a set of radio buttons: Sk
y, Premul, and Key. Since you're compositing now, you won't be using the Sky for
a backdrop. Switch the renderer from Sky to Premul. Without being too technical
, Premul, which stands for "Premultiplied," combines a render with its Alpha cha
nnel before handing it off to the compositor, creating very nice edges.
Figure RCT.26: The renderer set to Premul.
At this point, you could hit F12 to re-render the whole node network, or you can
LMB click on the little Render icon next to the RenderLayers popup selector, to
trigger a render of only that node.
Figure RCT.26.a: The "render this node" button.
Figure RCT.27: The composite, now with Premul in use.
Sidebar: Order of Processing
Several compositing nodes have multiple inputs, just like the AlphaOver node. It s
important to know the order of processing so you can achieve consistent results
.
In the example, you wanted the original RenderLayers image to be on top of your
shadow image. The stacking order in blender is upside down from what you might e
xpect. That means that the lowest image input in fact layers over the image inpu
t above it. There's no good way to learn that other than simply getting it wrong
a few times and seeing the result.
Just remember that multiple node inputs treat the lowest socket as the most impo
rtant.
End sidebar.
Adding Colors
A black and white shadow may be exactly what you were after, but the RGB Curves
node offers much more to help liven up an image. As the illustrations in the boo
k are grayscale, you'll have to look to your own display to see the results of t
his section.
Let s start with the shadow and add a little color.
In the RGB Curves node are four buttons marked C, R, G, and B. When pressed, the
R, G, and B buttons allow access to the adjustment curve for only that componen
t of the image (Red, Green and Blue), leaving the others as they are. The C opti
on (Combined), which is what you used in the above example, changes all three ch
annels at once. This means that you can alter individual colors in an image as w
ell as the combined values.
You already have the Combined curve set to invert the image. LMB on the "R" to w
ork with the Red channel only, and LMB again somewhere near the center of the cu
rve. This creates a new point on the line.
Drag that point upward until it is about halfway up the next grid division as sh
own in this illustration:
Figure RCT.29: [no text]
Switch to the "B" (Blue) button and LMB click to create a new point on its curve
. Move it close to the position shown on the right side of the illustration.
Because the Combined curve has already inverted the image, the effects of moving
the individual Red and Blue curves are the opposite of its normal behavior. How
ever, adjusting the color with these curves is fairly intuitive, and you are wel
come to experiment a little, moving any of the curves to see its effect on the s
hadow color. Before you continue, though, try to get back to something that rese
mbles the curves from the above illustration.
The render result window should now show a nice inky-blue shadow. As a last exer
cise, let's try to add a yellow tint to both the background and the shadow. You
could do this by continuing to fine tune the RGB Curves. Instead, though, you'll
use a new node type that will give you more control.
Make room for a new node in your network by moving the AlphaOver and Composite n
odes to the right.
Remove the connection between the RGB Curves and AlphaOver nodes. With the RGB C
urves node selected, add a Mix node with Add->Color->Mix. Its Image input socket
should be automatically connected to the output of the RGB Curves node.
Connect the Image output of the Mix node to the upper input of the AlphaOver nod
e.
Figure RCT.31: The Mix node added to the network and connected.
Mixing Images
The Mix node has two Image input sockets. If only one of those sockets has an in
coming connection, the other defaults to a color swatch, which can be set by LMB
clicking on it and using the standard Blender color picker that pops up. This l
ets you mix an area of uniform color into an image.
As mentioned earlier, the bottom socket on the Mix node's inputs will represent
the highest image in the composite, so LMB drag the connector downward from the
upper socket to the lower one.
LMB in the color swatch beside the upper Image socket and set the RGB values in
the color picker to something like this:
Figure RCT.32: Set the color to R 0.98, G 0.92, B 0.79.
Set the Mix mode dropdown menu to Multiply, and Fac (Mix Factor) to 0.65. This f
actor indicates that the dominant image (the lowest in the stack) will be blende
d at 65% opacity.
Figure RCT.33 [no text]
You may have noticed that there is a vast array of mix modes when you selected "
Multiply" from the dropdown list. In the current release, there are sixteen diff
erent mixing modes. Although these ways of blending images will be familiar to y
ou if you have used 2D painting packages, it's easy to try them out within the N
ode Editor and see how they affect the final composite for yourself.
Without any more experimentation, though, here is what you are left with:
Figure RCT.34: Our final render.
And the node network to generate that from a simple grayscale render of three ob
jects:
Figure RCT.35: The final Composite node network.
Conclusion
In this basic tutorial, you have learned that Composite node networks, though co
mplex when finished, are fairly simple to build. All the core operations of crea
ting, moving, deleting and connecting nodes have been covered, as well as a good
work flow for approaching a compositing problem. Next, we'll look at several co
mmon post-processing tasks and how to accomplish them with the Composite nodes.
As you will see, the nearly instant response to changed node settings will speed
up your creative process and help to make you much more productive as a 3D arti
st.
BLENDER OPEN CONTENT LICENSE
Terms and Conditions for Copying, Distributing, and Modifying
Items other than copying, distributing, and modifying the Content with which t
his license was distributed (such as using, etc.) are outside the scope of this
license.
1. You may copy and distribute exact replicas of the OpenContent (OC) as you re
ceive it, in any medium, provided that you conspicuously and appropriately publ
OC AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPEC
IAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO
USE THE OC, EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILI
TY OF SUCH DAMAGES.