ScannedGrain

Applies actual scans of film grain to replicate the grain of the film stock. Frames are selected from a loop of scanned film grain and applied to the input image. This allows you to add grain to CG creations to match the original plate or ’age’ footage artificially.

See also Grain and F_ReGrain.

Inputs and Controls

Connection Type

Connection Name

Function

Input

unnamed

The image sequence to receive the grain.

mask

An optional image to use as a mask. By default, the grain is limited to the non-black areas of the mask.

At first, the mask input appears as a triangle on the right side of the node, but when you drag it, it turns into an arrow labeled mask. If you cannot see the mask input, ensure that the mask control is disabled or set to none.

Control (UI)

Knob (Scripting)

Default Value

Function

ScannedGrain Tab

grain

fullGrain

[file dir $program_name]/FilmGrain/

Sets the file path of your scanned grain images.

To create the film grain images:

1.   Film a gray card and scan the result to file.
2.   Blur the scanned image.
3.   Subtract the blurred image from the original.
4.   Add 0.5 to the rgb channels.
5.   Save the scanned grain image to the desired file type (.rgb for example).

frame range

fullGrain.first_
frame

1

Sets the first frame of the grain file to use.

fullGrain.last_
frame

50

Sets the last frame of the grain file to use. Approximately 50 frames are required to produce random grain.

min. width

minwidth

721

Sets the minimum width (in pixels) that images must have in order for grain to be applied.

Set a minimum width to ensure that the grain resolution matches the image otherwise you may get unwanted results.

resize

resize

enabled

When enabled, resizes the grain plate to match your input.

When disabled, the grain plate is cropped to match.

flip

flip

disabled

Increases the number of grain images available by allowing random horizontal and vertical flipping of the grain plate. Flipping can produce a more random grain spread, but increases processing time.

offset

offset

0.5

Sets the value of neutral gray to subtract from images. The closer this value is to the input gray, the more grain is visible.

Amount of grain

amount rgb

amount

0.30000001

Sets the multiplier for the red channel applied to the grain.

0.40000001

Sets the multiplier for the green channel applied to the grain.

0.5

Sets the multiplier for the blue channel applied to the grain.

saturation

saturation

1

Sets the intensity of grain hue across all channels.

use precomputed table

use_precomputed

enabled

When enabled, the output LUT is clamped between 0 and 1. This control is enabled by default for backward compatibility.

When disabled, Nuke does not clamp the LUT.

curve editor

weight

N/A

The grain sequence’s color curves. You can use these to edit the gain, gamma, contrast, and so on for individual channels. You can also look up color information for the current pixel in the Viewer.

reset

N/A

N/A

Returns the selected curve(s) to the default values.

low_clip

low_clip

0

Sets the low threshold based on the input image.

In general, when grain is added to an image, some input pixel values become higher, while others become lower. This control allows you to stop pixel values from going below a certain value, such as the blackpoint in your image.

seed

seed

1

A different grain pattern is produced for each frame. Change this number to get a different initial pattern, for instance if you are using multiple ScannedGrain nodes.

If you require an identical grain plate for every frame, enter -frame in this field.

mask

N/A

disabled

Enables the associated mask channel to the right. Disabling this checkbox is the same as setting the channel to none.

maskChannelInput

none

The channel to use as a mask. By default, the grain is limited to the non-black areas of this channel.

inject

inject

disabled

Copies the mask input to the predefined mask.a channel. Injecting the mask allows you to use the same mask further downstream.

invert

invert_mask

disabled

Inverts the use of the mask channel, so that grain is limited to the non-white areas of the mask.

fringe

fringe

disabled

When enabled, only apply the effect to the edge of the mask.

When disabled, the effect is applied to the entire mask.

(un)premult by

N/A

disabled

Enables the associated channel to the right. Disabling this checkbox is the same as setting the channel to none.

unpremult

none

The image is divided by this channel before being processed, and multiplied again afterwards.

If you are using premultiplied input images, you may want to check (un)premult by and select rgba.alpha here. This will simulate applying the grain before the premultiplication was done. It is the same as adding an Unpremult node before this node and a Premult node after, but allows you to work faster if you’re only using one ScannedGrain node.

If you are using unpremultiplied input images, you should leave this set to none.

invert

invert_unpremult

disabled

Inverts the use of the (un)premultiply channel.

mix

mix

1

Dissolves between the original image at 0 and the full grain effect at 1.

Step-by-Step Guides

Using Practical Grain