Using an I/O Graph to Visualize Color Operations
And I/O graph (input versus output graph) is a great way to understand color operations. The X axis represents the color coming in, and the Y axis represents the color going out. A perfectly diagonal line therefore represents no color correction. The graph shows what the color operation is doing and the changes to the dynamic range.
To view an I/O graph like this, you can bring in a pre-made script I made.
- Choose File > Import Script to load another script from the disk and merge it with the script you have been building.
- In the File Browser that opens, navigate to chapter04 and click IO_graph.nk to import it into your current script.
Notice that when you imported the script (which is only four nodes) all of its nodes were selected. This is very convenient as you can immediately move the newly imported tree to a suitable place in your Node Graph.
Make sure the imported tree is not sitting on top of your existing tree. Move it aside to somewhere suitable as in FIGURE 4.8.
Figure 4.8 You now have two trees in your DAG.
Make sure you are viewing the output of Expression1.
A quick explanation of the script you imported, node by node:
- The first node is a Reformat node, which defines the resolution of your image. In this case, 256x256. Notice that its input isn't connected to anything. This is a good way to set a resolution for your tree.
- The second node is a Ramp. This can be created from the Draw toolbox. This node generates ramps—in this case, a black to white horizontal ramp from edge to edge.
- The third node is a Backdrop node, used to highlight areas in the tree. You can find it in the toolbox called Other. It indicates where to add your color correction nodes in the next step.
- The fourth and last node is an Expression node. This is a very powerful node. It can be found in the Color > Math toolbox. It lets the user write an expression with which to draw an image. You can do a lot of things with this node, from simple color operations (such as adding or multiplying, though this is wasteful) to complex warps or redrawing of different kinds of images all together. In this case, you use this node to draw values of a horizontal black to white ramp (you have the ramp from above) on-screen as white pixels in the corresponding height in the image. A value of 0.5 in the ramp will generate a white pixel halfway up the Y resolution in the output of the Expression node. The left-most pixel is black in the ramp, and shows as a white pixel at the bottom of your screen. The middle pixel is a value of 0.5 and so shows as a white pixel in the middle of the screen. The right-most pixel is a value of 1 and so draws a white pixel at the top of the screen. All these white pixels together form a diagonal line (FIGURE 4.9). Changing the color of the ramp will change the line. This happens on each of the three color channels individually.
Figure 4.9 The I/O graph at its default state.
Let's start using this I/O Graph tree. You will insert a Color node in between Ramp1 and Expression1 and look at the resulting I/O graph.
- Insert an Add node from the Color > Math toolbox after Ramp1 as shown in FIGURE 4.10.
Figure 4.10 Add2 has been inserted after Ramp1 and will change your I/O graph.
Bring the value of Add2's value property to around 0.1.
You can see, as in FIGURE 4.11, that the Add operation changes the whole dynamic range of your graph, and therefore, for any image.
Figure 4.11 The whole graph is raised or lowered in unison.
Let's replace your Add node with a Multiply node. You've never done this before, so pay attention.
- With Add2 selected, Ctrl/Cmd-click the Multiply node in the Color > Math toolbox to replace the selected node with the newly created one.
- Increase and decrease Multiply2's value.
You can also click the color wheel and change the RGB channels individually (FIGURE 4.12).
Figure 4.12 The graph changes more the further away it is from 0.
The Multiply operation has more effect on the highlights than the lowlights. You can see when you are moving the slider that the 0 point stays put, and the further away you go from 0 the effect becomes stronger.
Let's try Gamma. Maybe you don't know what a Gamma curve looks like. Well, here's your chance.
- Replace Multiply2 with a Gamma node from the Color or Math toolbox by holding down Ctrl/Cmd and clicking Gamma from the Color > Math toolbox.
Load Gamma2's Color Wheel and Color Sliders panel and play with the sliders for R, G, and B.
You should now get a similar result to FIGURE 4.13.
Figure 4.13 Notice that only the middle part of the graph moves.
The Gamma operation changes the midtones without changing the blacks or whites. You can tell that the point at the furthest left and at the furthest right are not moving.
Contrast is next.
- Replace Gamma2 with a RolloffContrast node in the Color toolbox.
Bring RolloffContrast2's contrast value to 1.5.
The contrast operation pushes the two parts of the dynamic range away from one another (FIGURE 4.14).
Figure 4.14 A basic contrast curve.
Play around with RolloffContrast2's Center property. When you are finished, set the value to 0.
Here you can see what actually happens when you play with the Center slider. It moves the point that defines where the lowlights and highlights are. When leaving the center at 1, you can see that the curve is identical to a Multiply curve (FIGURE 4.15).
Figure 4.15 A Center value of 0 makes Contrast behave like Multiply.
Move the Center slider up to 1 (FIGURE 4.16).
Figure 4.16 Moving the slider up to 1 is actually a Lift operation.
This is a Lift operation, which is covered later in this chapter. Your white point is locked, while everything else changes—the opposite of Multiply.
RolloffContrast has one other property you can see in the I/O graph. This property, called Soft Clip, is the property that gives this node its name. This property smooths out the edges of the curve so that colors don't all of a sudden turn to black or white and result in a harsh transition.
Move the center slider to 0.5 and start to increase the Soft Clip slider. I stopped at 0.55.
FIGURE 4.17 shows what happens when you increase the soft clip. This creates a much more appealing result, which is unique to this node.
Figure 4.17 This smooth edge to the curve is what gives RolloffContrast its name.
If you have a fair amount of experience, you must have noticed that the I/O graph looks a lot like a tool you may have used in the past—something applications such as Adobe After Effects call Curves. In Nuke, this is called ColorLookup, and it is discussed in the next section.