Applying Grain

Grain matching - ensuring that all of the elements in a composite, including those which were digitally generated, look like they were shot on the same film stock - is often one of the final steps in achieving a convincing integration of all of a composite’s elements. Nuke offers effects for synthetically creating grain and for reading in practically-created grain (grain derived from actual film stock).

An example of applying grain
to an image: Grainless image.
An example of applying grain
to an image: Grained image.

Using Synthetic Grain

Nuke offers several nodes for creating synthetic grain: Dither, Grain, ScannedGrain, and if you have a NukeX license, F_ReGrain. Of these, Dither is the crudest - it basically lets you specify the amount of noise per channel.

Grain includes presets for matching film stock and a means for controlling the mix between the generated grain and the backplate. ScannedGrain offers film stock presets, plus synthetic grain controls for applying practical grain.

F_ReGrain, for NukeX, is designed to sample an area of grain from one image and then to generate unlimited amounts of this grain with exactly the same statistics as the original. This new grain can then be applied to another image. See Using F_ReGrain for more information.

To add synthetic grain with the Grain node

1.   Click Draw > Grain to insert a Grain node at the appropriate place in your script.
2.   Connect a Viewer to the output of the Grain node so you can see the effect of your changes.

3.   From the presets dropdown menu, select one of the film stock you want to match.
4.   Adjust the Size sliders for the red, green, and blue channels to shrink or enlarge the granules.
5.   Adjust the Irregularity sliders to increase or decrease the random quality of the grain, according to the different channels.
6.   Adjust the Intensity sliders to increase or decrease the contrast of the grain against the original image.

Using Practical Grain

Although Nuke’s ScannedGrain node offers controls for creating synthetic grain (ones comparable to those just discussed), its main use is for reading in and applying scanned grain - that is, grain derived from actual film stock. If your facility has such sequences available, you can read them in and apply them using the ScannedGrain node. Creating grain files is described below, as well as using the resulting grain files with the ScannedGrain node.

To Create Film Stock Sequences

1.   Film a gray card. Only about 50 frames are needed.
2.   Scan the film in.
3.   Select Image > Read to load the scanned image into Nuke.
4.   Add a Blur node (Filter > Blur) after the image to blur the image until you cannot see any grain. Then, blur the image a bit more.
5.   Select Merge > Merge to insert a Merge node in your script. Connect the A input of the Merge node into the original image, and the B input into the Blur node. Then, open the Merge controls and select minus from the operation dropdown menu. The blurred image is subtracted from the original image.

The purpose of this and the previous step is to subtract any overall gray level from the grain so that only the grain is left.

6.   Select Color > Math > Add to insert an Add node after the minus node. In the Add node controls, enter 0.5 in the value field. This adds a value of 0.5 to all channels.

This step is necessary, because the ScannedGrain node subtracts 0.5 from the channels when it reads the grain file (the subtraction is needed to store negative numbers in most file formats).

7.   Select Image > Write to insert a Write node after the Add node. Render the output. Any file format will do (for example, we have used the .rgb extension in the grain files on our website).

To Add Scanned Grain with the ScannedGrain Node

1.   Click Draw > ScannedGrain to insert a ScannedGrain node at the appropriate place in your script.
2.   Connect a Viewer to the output of the ScannedGrain node so you can see the effect of your changes.
3.   Click the folder icon of the grain field and navigate to the appropriate film stock sequence. Select Open.
4.   If necessary, check the resize box to scale the grain sequence up or down to match your working resolution.
5.   In the min. width field, define a minimum width (in pixels) that images have to have in order to receive grain.
6.   Enter values into the red, green, and blue amount fields to increase or decrease on a per-channel basis the density of granules. (This is accomplished, crudely speaking, by boosting or reducing the gain of the grain sequence.)

Now you’re ready to fine-tune the blending between the grain and backplate.

To Mix the Grain and Backplate

1.   Drag on the saturation slider to increase or decrease the intensity of the grain’s hue across all channels.
2.   If necessary, you can also use the supplied curve editor to edit the grain sequence’s color curves. In this manner, you can alter gain, gamma, contrast, etc. on a per channel basis. (These curves function in the same manner as those described in Using ColorLookup Curves).
3.   To set a low threshold, based on the input image, below which the grain is not subtracted, adjust the low_clip slider.