Processing and Formatting Effects > A/V Tools > FX Tools >

# Using Logical Operations

Logical operations are applied separately to each of the red, green, and blue components of images. You can apply Logic Ops commands to combine the RGB channels of corresponding pixels from two source images, described as follows.

Add
  Adds the luma values of the corresponding pixels from two source clips and assigns the resulting value to the corresponding pixel in the generated clip. If the result is greater than 255, the pixel in the destination clip is clamped at a value of 255 (white).

The order in which the two source clips are selected does not affect the result of the Add operation. The generated clip is brighter than either of the two selected source clips.

And
  Applies a bitwise logical AND operation between the RGB channels of corresponding pixels in the two source clips. The order in which the two source clips are selected does not affect the result of the AND operation.
AndInv
  Applies a bitwise logical AND operation between the negative of the RGB channels of the pixels of the front clip and the RGB channels of the pixels of the back clip.
AndRev
  Applies a bitwise logical AND operation between the negative of the RGB channels of the pixels of the back clip and the RGB channels of the pixels of the front clip. AndRev and AndInv yield the same result if you switch the order of the two source clips.
Difference
  Calculates the difference between the RGB channels of the corresponding pixels of the two source clips. As opposed to Subtract, the order of the two source clips does not matter, as the smaller channel value is always subtracted from the larger channel value.

Blending with white inverts the colour channel values; blending with black produces no change.

Exclusion
  Adds the RGB channel values of the corresponding pixels from the two source clips, then subtracts twice the product of these channels. The order of the source clips does not matter.
HardLight
  Multiplies or screens the selected colour of the front clip onto the back clip, depending on the blend colour. The effect is similar to shining a harsh spotlight on the image, and greatly reduces the contrast levels in the image.

If the blend colour (light source) is lighter than 50% grey, the image is lightened as if it were screened—this is useful for adding highlights to an image. If the blend colour is darker than 50% grey, the image is darkened, as if it were multiplied—this is useful for adding shadows.

Max/Lighten
  Compares the RGB channels of each pixel of the source clips individually and returns the larger of the two values. The order in which you select the source clips does not affect the result.
Min/Darken
  Compares the RGB channels of each pixel of the source clips individually and returns the smaller of the two values in the resulting clip. The order in which you select the source clips does not affect the result.
Multiply
  Multiplies the RGB channel values of corresponding pixels of the two source clips and normalizes the result by dividing by 255. The resulting RGB channel values are assigned to the corresponding pixels in the generated clip.

The order in which you select the source clips does not affect the result.

Nand
  Applies a bitwise logical AND operation between the RGB channel values of the corresponding pixels of the two source clips, negates the result, and assigns the result to the channels of the corresponding pixels in the generated clip.
Nor
  Applies a bitwise logical OR operation between the RGB channel values of the corresponding pixels of the two source clips, negates the result, and assigns the result to the channels of the corresponding pixels in the generated clip.

The order in which you select the source clips does not affect the result.

Or
  Applies a bitwise logical OR operation between the RGB channel values of the corresponding pixels of the two source clips, and assigns the result to the channels of the corresponding pixel in the generated clip.

The order in which you select the source clips does not affect the result.

OrInv
  Applies a bitwise logical OR operation between the negative of the RGB channel values of the pixels in the front clip and the RGB channel values of the corresponding pixels in the back clip, and assigns the result to the channels of the corresponding pixels in the generated clip.
OrRev
  Applies a bitwise logical OR operation between the RGB channel values of the pixels in the front clip and the negative of the RGB channel values of the corresponding pixel in the back clip, and assigns the result to the channels of the corresponding pixels in the generated clip.

OrRev and OrInv yield the same result if you switch the order of the two source clips.

Overlay
  Multiplies or screens the colours, depending on the RGB channel values of the first clip you select. Patterns or colours overlay the existing RGB channel values while preserving the highlights and shadows of the first clip's colour. The first clip's colour is not replaced but is mixed with the second clip's colour to reflect the lightness or darkness of the original colour.
Screen
  Multiplies the inverse of the second clip's colours with the colours of the first clip. The resulting colour is always lighter. The colour remains unchanged when you screen with black. Screening with white produces white. The effect is similar to projecting multiple photographic slides on top of each other.
SoftLight
  Shines a soft, diffuse light on the image. If the blend colour (light source) is lighter than 50% grey, the image is lightened. If the blend colour is darker than 50% grey, the image is darkened.

Using this mode with a black frame results in a very dark effect, with white a very bright one.

Subtract
  Subtracts the RGB channel values of the pixels from the back clip from the RGB channel values of the pixels from the front clip and assigns the result to the RGB channel values of the pixel in the generated clip. If an RGB channel value from the back clip is larger than the corresponding channel value in the front clip, yielding a negative result, that result is clamped at 0 (black).

The order of the source clips is important since the back clip is subtracted from the front clip. The resulting clip is always darker than either of the two source clips.

Xnor
  Applies a bitwise logical exclusive OR operation between the RGB channel values of the corresponding pixels of the two source clips, negates the result, and assigns the result to the channels of the corresponding pixels in the generated clip.

The order in which you select the source clips does not affect the result.

Xor
  Applies a bitwise logical exclusive OR operation between the RGB channel values of the corresponding pixels of the two source clips, and assigns the result to the channels of the corresponding pixels in the generated clip.

The order in which you select the source clips does not affect the result.

To use logical operations:

1. Select FX from the A/V Tools box and then click Logic Ops.

   The Logoc Ops controls appear.

2. Select the blend mode you want to use from the Logical Operations box.
3. Select an option from the Input Mode box. You can select either a Front and a Back clip, or a Front, Back, and Matte clip.
4. Specify the transparency value.

   Use the default value of 0.0% to combine your clips completely. Using any value above zero results in an effect in which the specified layers are combined, but you can see though the combined clips to the original Back clip.

5. Select a rendering option from the Clamp Render box. This box provides options for colour and luminance values on output in the 16-bit floating point processing pipeline.
6. Select the source clips to be used for the operation. The order in which clips are selected affects the outcome of some operations.
   NoteIf you want to use clips of different resolutions, resize them according to the common destination resolution.
7. Select a destination in the Source Area or Record Area.

   The result clip appears in the selected destination.