Chapter 19: Filter Nodes

The Filter nodes menu includes a variety of filters for blurring and sharpening, adding and removing grain, embossing, warping, and other effects.

In This Chapter

Blur Node

Bump Map Node

Comment Node

Convolve Node

Degrain Node

Edge Node

Emboss Node

Grain Node

Posterize Node

Rank Node

Sharpen Node

Text Node

Time Blur Node

Unsharp Mask Node

Vector Blur Node

Vector Warp Node

Xpresso Node

A number of these nodes perform a convolution or other neighborhood operation on each pixel in the image. For the most detailed description of the convolution process, refer to the Convolve node, which is a comprehensive convolution filter featuring a library of kernel presets. The Rank node is also a multipurpose filter that can be configured for various tasks and offers a menu of preset operations.

Both Convolve and Rank examine pixels surrounding the pixel currently being operated on to obtain a value. However, Convolve averages the pixels in the sample area to obtain a value, whereas Rank sorts the pixels in the sample area and picks one to use for the value based on its ranking in the sort list.

The Blur node and the Sharpen node can be used by setting a single parameter, or advanced filtering options in each node can be accessed to precisely control a number of variables. Time Blur averages pixels from different frames rather than pixels in an area of the same frame. Vector Blur , which blurs directionally, is often used for motion blurs.

The Grain node includes presets for various film stocks, and offers parameters for custom grain pattern matching, while Degrain offers comprehensive control over the process of removing grain.

Another special-purpose filter is Unsharp Mask , which sharpens an image using a specific photographic technique that involves boosting the contrast in areas with a lot of detail.

The Bump Map node creates a two-channel floating point output that can then be used as a mask input to other nodes, such as Emboss and Vector Warp , that create embossing, ripples and other distortions. The Posterize node, which reduces colors to an indexed palette, can be used to create broad regions of uniform color.

The output of the Edge node, which detects the edges of an image, is often used as a mask input to other nodes to confine processing to edge or non-edge areas. The Text node, which is used to add a layer of text over an image, can be used for titling, adding time code, and so forth.

The Comment node, unlike the other nodes in this group, does not process image data; rather, it is used to store remarks.

The Xpresso node is perhaps the most versatile node in RAYZ. To use Xpresso, you type expressions into a field, which enables you to essentially design your own filter, composite, or other operator. Xpresso is a multi-input node--every time you add an input to Xpresso a new connector is created.



Blur Node

Blur node icon. The Blur node enables you to blur an image, or selected channels of an image.

The Blur node is a convolution filter that performs the equivalent of low-pass filtering in the frequency domain, where the high frequencies from a signal are filtered out and only the low frequencies are allowed to pass through. Because areas of greatest visual detail in an image are expressed as high frequencies, the low-pass filter effectively blurs the image.

The Blur node accepts one or two inputs, with the optional second input used as a mask to control the area of the primary input that is blurred by the node. For more information, see Using Mask Inputs in chapter 7.

Blur Parameters

All you have to do to use the Blur node is specify a value in the Kernel Size parameter--higher values blur more and lower values blur less. However, you also have the option to customize the kernel used in the convolution by modifying the other kernel parameters. (For more information about convolution kernels, see also How Convolve Works.)

Kernel Size

The Kernel Size parameter is used to control the amount of blurring, in a range that represents approximately 5 percent of the total width of the input image, although the upper end of the range is unconstrained. The default Kernel Size value is equivalent to 1 percent of the total width.

Tip:

 

To make extremely fine incremental adjustments using the slider, hold down the Shift key as you drag the slider back and forth.

Kernel Shape

The Kernel Shape menu specifies the distribution function to use to weight the kernel values; that is, the extent to which surrounding pixels will contribute to the blur. The default is Gaussian, a bell-shaped distribution curve. The other choices are Box (constant), Linear (triangle), Quadratic, and Cubic.

The optimal choice will depend on the nature of the image and the effect you wish to achieve. The Blur node operation is so fast with any of them that it is easy to try all the different options on an image until you find the best one.

Kernel Type

The Kernel Type parameter allows you to choose whether the node should use Integer or Floating Point kernel values for the calculation. Floating Point is the default, and precision restraints make it inefficient to compute Cubic or Gaussian functions using integer math.

Border Style

The pixel currently being modified is in the center of a matrix of pixels that contribute to the effect. This means that when processing a pixel that borders the image, or when the operation area is sufficiently large, there will not be adjacent pixels on all sides to contribute to the calculation.

The Border Style menu specifies where the node will get the values it will use to fill the empty cells in the matrix as it processes each border pixel:

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (such as A for Alpha).



Bump Map Node

Bump Map node icon. The Bump Map node enables you to create a bump map that you can use as a mask input to other nodes to control embossing, rippling, or other effects that use pixel displacement, such as in the Vector Blur and Vector Warp nodes.

The Bump Map node uses a single, user-selectable channel of the input image. A surface normal, that is, a vector perpendicular to the surface, is calculated for each pixel of the selected channel by taking a weighted average of a sample of surrounding pixels. The value of the normal is based on the rate of change between the current pixel and neighboring pixels of the selected plane.

The data is output as a two-channel floating point image, with the value for the X component of the normal in the red channel, and the value for the Y component in the green.

Bump Map Parameters

Channel

Use the Channel menu to specify which channel of the input image should be used to calculate the surface normal for each pixel.

Radius

Pixels are sampled along the circumference of a circle surrounding the pixel currently being processed. The Radius parameter enables you to set the size of the radius that defines this circle in a range of 0 to 5.

You may wish to increase or decrease the radius of the sample area depending on the level of detail in the source image and the effect you wish to achieve. For example, a larger radius would result in a loss of local detail when used for an image with many fine lines.

Samples

The Samples parameter enables you to specify the number of surrounding pixels to be sampled in a range of 3 to 10. The default value is 4. Larger sample values may take longer to process but produce a more accurate result.



Comment Node

Comment node icon. The Comment node does not process image data. In fact, image data is always passed through the node without change. Instead, the Comment node is used to store notes and comments about any aspect of a shot.

You can use the Comment node to enter evaluation comments by a supervisor or to make notes about a particular effect for later reference. Such notes can be especially helpful when you have to come back days or weeks later and revise a shot, or reuse elements of it in a related shot or on a new project. Comments are also helpful when another compositor ends up working on the same file.

Note:

 

You may prefer to use Underlays in the Worksheet to annotate a network instead of or in addition to Comment nodes. For more information, refer to Adding Underlays to the Worksheet in chapter 5.

The Comment node has a single input connector, which is usually connected to whichever node the comment is about. The Comment node may branch off on its own, or it may be inserted into a data stream. In any case, the way the Comment node is connected does not affect the shot.

Comment Parameters

The Comment Node Panel offers a single parameter, a multi-line text field into which you enter your remarks. Click in the field and type your comment, pressing the Enter key when you are done.

To start a new line in the Comment field, hold down the Shift key as you press Enter.

Tip:

 

Use the Name field in the strip at the top of the Node Panel to give the comment a short, descriptive title that can be read on the Comment node in the Worksheet.



Convolve Node

Convolve node icon. The Convolve node is a convolution filter that can be used to sharpen or blur an image or detect its edges, depending on the type of filtering selected.

The Convolve node accepts one, two, or three inputs:

How Convolve Works

The Convolve node operates on each pixel in the input image in turn, modifying its value based on the values of surrounding pixels. The extent to which each adjacent pixel will affect the processing of the center pixel is determined by the convolution kernel.

The Kernel

A convolution kernel can be thought of as a square grid of cells placed over the group of pixels, with the pixel to be modified under the central cell of the grid. This grid, or matrix, of cells is referred to as the kernel.

Each cell in the kernel contains a value that determines how the corresponding pixel value under the cell will be used to modify the central pixel. The type of convolution filter you select will control the distribution of kernel cell values.

For example, to blur an image the values of the pixels under the grid would be averaged to generate the value to use for the central pixel. As the kernel operates on each pixel in the input image in turn, a blur effect is created in the output image.

If a simple box (constant) function is used to generate the cell values, each cell in the kernel will be equal, meaning that each pixel will contribute equally to the result. But if a nonlinear function such as Quadratic is used, the kernel will be weighted so that some cells will have greater values than others, meaning that some of the pixels will contribute more of their value to the result than others.

The Convolve node provides predefined convolution kernels for blurring, sharpening, and so forth that you select from the Kernel Library. However you can also a create a custom kernel and use it instead of a library kernel, as described next.

Using an Input as a Kernel

The middle, optional, input image is treated as a kernel in the convolution. That is, the value of each pixel represents a cell value in the kernel matrix. The kernel input must be a one-channel, floating point image. It can be square or rectangular, but it must be an odd number of pixels in both width and height. (The odd numbers are required because there must be a center cell in the matrix.)

Within these restrictions, there is no specific limit on the size of the kernel input. A relatively small kernel will still have a powerful effect, however, and the larger the kernel, the longer it will take to process the image.

Tip:

 

You can use a Color node to create a custom kernel input. Set the node to output a single-channel (select Alpha Only), floating point image.

Then, for example, you could set the size to 11 x 3 and the color to white to create a kernel that blurs the primary input to the Convolve node horizontally (vertical lines/edges would be affected most). A 3 x 11 image, on the other hand, would blur vertically, affecting horizontal edges most.

Convolve Parameters

Although the Convolve Node Panel provides a number of parameters, all you need to do is select the type of filtering from the Kernel Library menu and the other parameters are set accordingly. You can always adjust the other settings if necessary to fine-tune the result.

Kernel Library

The Library menu provides kernel presets: predefined cell matrices with different functions to perform various types of filtering, including blurring, sharpening, and edge detection.

Note:

 

The default size of the kernel is indicated for each preset ("3 x 3," for example), but you can change it by selecting a different size in the Kernel Size menu.

3 x 3 Average (Mild Blur)

This filter averages the cell values to create a mild blur.

3 x 3 Laplacian (Edges)

The Laplacian filter emphasizes edge detail in an image. (For more general sharpening, use High Pass instead. To generate an edge map, use the Canny or Prewitt filters.)

3 x 3 High Pass (Sharpen)

The High Pass filter is used to sharpen the image by emphasizing the high frequency image data that is associated with fine detail.

5 x 5 Low Pass (Stronger Blur)

The Low Pass filter is stronger than the Average blur. It will pass color frequencies in the lower ranges through to the output image; higher frequencies will be filtered out.

5 x 5 Gaussian (Blur)

The Gaussian filter is an alternative to the Low Pass filter for a strong blur that uses a Gaussian distribution function to define the kernel.

5 x 5 Quadratic (Smooth)

The Quadratic filter usually produces a subtle blur that removes noise to effectively smooth the image.

7 x 7 Prewitt (Vertical Edges)

The Prewitt filter is an alternative edge-detection tool to the Canny filter. The Prewitt filter finds edges that run vertically in the image.

7 x 7 Canny (Edges)

The Canny filter is a general edge-detection tool that creates an edge map of the input image, which is most often used as a mask input in other node operations.

Kernel Size

The Kernel Size menu enables you to select the size of the input matrix. It defaults to the size specified for the preset selected in the Kernel Library, but you can override the preset by choosing another size: 3 x 3 (9 cells), 5 x 5 (25 cells), or 7 x 7 (49 cells).

Kernel Type

The Kernel Type parameter specifies either Integer or Floating Point calculations. You can leave this parameter at the default setting for the filter preset currently selected in the Kernel Library menu. In some cases, however, Integer might be a bit faster for 8- or 16-bit input data.

Normalize Kernel

This parameter becomes active when floating point is selected in the Kernel Type menu. It ensures that the sum of the kernel is 1 by dividing each cell in the kernel by the sum of all the cells in the kernel. Otherwise, the overall brightness of the image may be affected.

Border Style

The pixel currently being modified is in the center of a grid of pixels that define the operation area (the kernel). This means that when processing a pixel that borders the image, or when the operation area is sufficiently large, there will not be adjacent pixels on all sides to contribute to the calculation.

The Border Style parameter enables you to specify where the node will obtain the values it will use to fill the empty cells in the kernel as it processes each border pixel. Select one of the following options from the menu:

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (such as A for Alpha).



Degrain Node

Degrain node icon. The Degrain node is used to help remove film grain and other noise from imagery. You can elect to perform a rank operation (a type of blur) on the input, or the more complex frequency analysis method, optimized for film or video imagery, by selecting an option from the Filter menu.

When you select a method, other parameters are set to default values based on the selection. You can start by using the defaults and examining the results. If necessary, you can then modify parameter values using the guidelines described in the next section.

The frequency analysis parameters require more care to use properly, but can result in decreasing the appearance of grain while preserving image detail and sharpness that would be lost otherwise.

The Degrain node accepts one or two inputs. The second, optional input is used for a mask image. For more information, see Using Mask Inputs in chapter 7.

Choosing a Degrain Method

Choose the method to use in the Filter Type menu. The best choice will depend on the specific imagery being degrained. Median Rank is the easiest to use, but the Frequency Analysis methods, one optimized for film grain and the other for video noise, may preserve more detail.

The Median Rank operation is similar to area operators used for some types of blurs. It will reduce the appearance of grain, but it can also eliminate fine image detail. This means that Median Rank may make some imagery unacceptably soft.

How Frequency Analysis Works

Grain and noise are related image phenomena involving high frequency changes in the image content, which tend to be more or less random. Pure noise is completely random, like the snow you get with bad TV reception. Grain is bit more structured, being somewhere between pure noise and structured high-frequency content. (A good example of structured high-frequency content would be a long shot of a waving crowd in a stadium.)

The frequency analysis method examines the image data as a signal. It performs what is known as a coring operation to identify and decrease high frequencies, where both noise and image detail reside. This can also produce an overly soft image, so the Degrain node performs additional operations that compensate for this problem by essentially adding detail and sharpness back into the degrained image.

The Degrain methods and parameters are described in detail below.

Degrain Parameters

Filter Type

The Filter Type menu enables you to specify the degrain method to use: Median Rank, Film Frequency Analysis (the default), or Video Frequency Analysis.

Median Rank Filter

This method uses a median rank operation, which sorts the value of the pixel currently being processed with those of its neighbors and uses the median (middle) value in the ranking. For more detailed information about this operator, refer to the description of the Rank Node.

Frequency Analysis Filters

Frequency analysis treats the image as a continuous signal of changing intensity (from one pixel to the next and then from one scan line to the next), as it would be represented in the frequency domain. This signal is analyzed to determine which parts of the signal are original, and which are noise or grain.

The part determined to be noise, based on the parameters set in the Advanced parameter group, is removed from the signal. (This implies that the success of frequency analysis for any particular image may depend on the Advanced parameter values.)

The "cleaned up" signal is then added back into the original in order to get some or all of the detail back into the image.

As the names imply, you should select Film Frequency Analysis to remove film grain and Video Frequency Analysis to remove video noise.

Kernel Size

The Kernel Size menu is used to specify the size of the kernel used by the Median Rank operation. As the menu options indicate, the smaller 3 x 3 kernel is faster, while the 5 x 5 kernel may take a little longer to process but produce better results.

Note:

 

The frequency analysis operations also reference the Kernel Size parameter for a blur operation that is performed initially to help identify the high frequency component, which is the difference between the original image and the blurred image.

Advanced Parameters

Expand the group to access the Advanced parameters, which become active whenever a frequency analysis filter is selected.

Tip:

 

If you are unfamiliar with frequency analysis, read the guidelines in the parameter descriptions below and then experiment with the settings as you view the result in the Image Viewer. Your eye will tell you when you have a satisfactory result.

Noise Level

The Noise Level parameter enables you to set a threshold that determines how much of the signal should be subject to filtering:

The master Noise Level parameter can be expanded to access individual channel controls.

For video imagery, it is only necessary to set the master Noise Level value, because video signals do not exhibit noise differences between the red, green and blue components.

For film , however, you may need to set the threshold values for each channel individually because each film layer responds differently to light. In particular, the blue layer typically has much more noise than the green layer. The default channel values are a good starting point, as they reflect a ratio typical for many film stocks: Red, 1.5; Green, 1; Blue, 2.

Gain and Exponent

These parameters help control how much of the new, degrained signal is added back into the original image.

Gain: Higher values will enhance detail, up to a point; after that, the image will begin to look harsh, or over-sharpened.

Exponent: The exponent parameter controls the slope of the nonlinear curve that represents the frequency distribution. In other words, the exponent controls how steep the climb is between low and high:

Typically, more filtering should be done at higher frequencies, which tend to encompass most of both noise and image detail, and less filtering should be done as the frequencies become lower. This relationship is not linear, however, as more of the high frequency material is added than the low frequency information.

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (such as A for Alpha).



Edge Node

Edge node icon. The Edge node is used to perform edge-detection on an image. The output of the Edge node is an edge map of the input, and it is often used as a mask image in blurs, dissolves, and other operations to improve the realism of composites by softening or otherwise adjusting foreground edges.

The Edge node works by comparing each pixel with surrounding pixels to find adjacent pixels with abrupt changes in value, which are identified as edges. The pixel currently being processed is the center pixel in a kernel (a matrix, or grid) that you specify using the Edge node parameters.

The Edge node accepts one or two inputs, the primary input and an optional mask input. For more information, see Using Mask Inputs in chapter 7.

Edge Parameters

Method

This parameter enables you to choose from the following edge-detection methods:

The 2 x 2 Cross is the faster method, but the default is Sobel, which provides excellent results without being too computationally intensive. Sobel also enables you to optimize the size of the filter area for the specific image being processed.

Filter Size

The Filter Size parameter becomes active when Sobel is the selected method. It enables you to specify the size of the kernel, or grid, of adjacent pixels that are examined and compared to the pixel currently being filtered. The value is expressed as a percentage of the total width of the input image, with the default being equivalent to 1 percent.

Border Style

The pixel currently being modified is in the center of a grid of pixels that define the operation area (the kernel). This means that when processing a pixel that borders the image, or when the operation area is sufficiently large, there will not be adjacent pixels on all sides to contribute to the calculation.

The Border Style parameter enables you to specify where the Edge node will obtain the values it will use to fill the empty cells in the kernel as it processes each border pixel. Select one of the following options from the menu:

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. To select a channel, depress the button labeled with that channel letter (such as A for Alpha). By default, all channels of the input image are selected.



Emboss Node

Emboss node icon. The Emboss node embosses an image by using a bump map, in effect raising in relief certain elements of the primary image. You can specify the magnitude of the effect as well as the direction of the simulated light source illuminating the embossed image, and other lighting characteristics.

The Emboss node requires two inputs, the image to be embossed, and the bump map. The bump map input must be a two-channel image such as that created by the Bump Map Node. The bump map can be generated from the input imagery or from a different image, depending on the effect you want to achieve.

Emboss Parameters

The Emboss parameters are extremely interactive, as they simulate dramatic changes in light and shadow across their range. If you need to match the lighting in other imagery, start by adjusting the Light Direction parameters before making any other adjustments. If you are trying to create an effect less directly related to real-world conditions, however, you could start with any parameter.

Magnitude

The Magnitude parameter controls the general level of the embossing. The default value is 1, in a range of 0 to 2. As you increase or decrease this value, the Emboss node lengthens or shortens the vectors of the bump map accordingly.

Light Direction

The Light Direction parameter is used to specify the location in xyz coordinate space of the simulated light source.

Ambient

The Ambient parameter controls the level of non-directional, or surrounding, illumination in a range of 0 to 1. The default value is 0.3.

Diffuse

The Diffuse parameter controls the level of reflected light in a range of 0 to 3. The default value is 1.7.

Specular

The Specular parameter controls the level of specular highlighting, the bright highlights from shiny surfaces. The parameter range is 0 to 1, with a default value of 0.8. The higher the value, the more white will be visible on the raised areas that are reflecting the most light.

Shiny

The Shiny parameter represents the specular exponent and controls the size of specular highlights. The default value is 15, in a range of 0 to 30.

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, the RGB channels of the input image are selected. To select or deselect a channel, press the button labeled with that channel letter (such as A for Alpha).



Grain Node

Grain node icon. The Grain node is used to simulate the look of film grain. Adding grain to CG elements that will be composited over film footage is one of the most effective ways to increase the realism of a composite.

There are three ways to use the Grain node. The Film Type menu offers presets to match a number of popular film stocks. The selected grain pattern can be modified, if necessary, by adjusting the Weight and Grain Size parameters.

In addition to using the Film Type presets, however, you can select Custom mode, which activates parameters in which you can enter values derived from statistical analysis of a specific film type not included in the menu.

You also have the option to connect a reference image to the Grain node and use the Grain tools in the Image Viewer to select areas for analysis. The node will set the custom parameter values based on the grain pattern in the reference image, as explained in Analyzing the Grain in a Reference Image.

Image showing the grain analysis tools in the Image Viewer.

Fig. 19.1 Grain analysis can be performed on a reference image.

In addition to the primary input, the Grain node accepts two optional inputs:

Analyzing the Grain in a Reference Image

To generate a grain pattern that matches the grain in another image, follow these steps:

  1. Connect the image with the grain you want to match to the reference input of the Grain node.
  2. Display the Grain node in an Image Viewer, and use the Source menu to view the reference image. The hotkey is s for "source," which cycles the display through all input images and the output image in turn.
  3. Examine the reference image to locate areas of homogenous color or smooth gradations. Be sure to avoid image areas with detail, which may be interpreted as grain.
  4. The backing area of a bluescreen image is an ideal choice, as is a gray card or similar calibration frame, assuming such footage was shot and digitized.

  5. Drag across an appropriate area to draw a bounding box around it. You do not have to select a single contiguous area; you can create as many selection boxes as you need. This is recommended if the image has so much detail throughout that it is hard to select a single large area.
  6. If necessary, you can use the Undo button in the Grain tool strip in the Image Viewer to delete the last selection box. Use the Reset button to delete all of them.

  7. Press the Analyze button in the Grain tool strip. The node will analyze the selected areas in the reference image to set the Custom parameters in the Film Type group.
  8. As soon as you press the Analyze button, the Film Type menu in the Grain Node Panel switches to Custom, if that option was not already selected.

  9. Use the Source menu to switch the Image Viewer display to the output image. You can make further adjustments to the node parameter values manually, if necessary.

Note:

 

If the results seem extreme, the problem may be that the node has interpreted details in the image as grain.

In this case, delete the selection boxes by pressing the Reset button and try selecting a different area of the reference image to analyze.

Grain Parameters

Film Type

The Film Type menu enables you to select preset values optimized to match the grain characteristics of various film stocks:

Note:

 

When two versions of a film stock, ac and nc, are available, choose "ac" to reproduce film scanned with aperture correction, and "nc" for film scanned without aperture correction.

The pattern generated by the selected preset can be adjusted using the Weight and Grain Size parameters, if necessary.

Custom Film Type Parameters

The Film Type menu also includes a Custom option that you can use to set the parameters manually by specifying values in the Custom Film Type parameters, which offer a level of precision suited to measurements derived from statistical analysis of a particular film stock. If you select Custom from the Film Type menu, additional parameters are activated, which can be accessed by expanding the Film Type group.

Image showing the Custom Film Type parameters in the Grain Node Panel.

Fig. 19.2 Expand the Film Type group to access these parameters, which become active when Custom is selected from the Film Type menu.

The Custom parameters--Standard Deviation, Spatial Correlation, and Color Correlation--can be used alone or in conjunction the Weight and Grain Size parameters that are used to adjust preset film stocks.

The Standard Deviation value is multiplied by the Weight value, and the Spatial Correlation value is multiplied by the Grain Size value to generate the custom grain pattern. (The default Weight and Grain Size values are 1, however, which obviously will not affect the output.)

Note:

 

The Custom parameters are set by the Grain node automatically whenever you use the grain analysis tools in the Image Viewer to match the grain pattern in a reference image.

Standard Deviation

This parameter specifies the strength of the grain in units representing the standard deviation value measured by statistical analysis of a particular film sample. Higher standard deviation values reflect more variation in the grain, which makes the grain more apparent.

The Standard Deviation parameter can be expanded to access individual controls for the Red, Green, and Blue channels.

Spatial Correlation

This parameter specifies the size of the grain in units representing the spatial correlation value measured by statistical analysis of a particular film sample. Higher spatial correlation values increase the average size of the grain.

The Spatial Correlation parameter can be expanded to access individual controls for the Red, Green, and Blue channels.

Color Correlation

This parameter specifies the apparent colorfulness of the grain in units representing the color correlation value measured by statistical analysis of a particular film sample.

The value represents how closely the grain in each channel overlaps. This means that negative color correlation values decrease the amount of overlap, which increases the apparent color of the grain, while positive values decrease its colorfulness.

Weight

The Weight parameter value is a scale factor that adjusts the apparent strength of the grain in a range of 0-2. The default value is 1, which has no effect on the output. Larger Weight values make the output look grainier, while smaller values make the grain less apparent.

You can expand the Weight parameter if you need to adjust the red, green, and blue channels individually.

Grain Size

The Grain Size parameter value is a scale factor that adjusts the average size of the grain in a range of 0-2. The default value of 1 has no effect on the output. Higher Grain Size values make the grain flecks appear larger on average, while lower values make the grain appear smaller.

Random Seed

The seed value is used by the node to generate a sequence of random numbers for the grain operation, which means that animating the Seed parameter will vary the grain pattern for each frame.

Since this is almost always preferable, the Random Seed parameter is animated by default using $F. This global variable represents the current frame number, which means that by definition it generates a different seed value for every frame.



Posterize Node

Posterize node icon. The Posterize node remaps the pixels of an input image to a reduced palette of colors to create large areas of solid color. You can specify the number of colors per channel to use, as well as which channels of the input to modify.

For example, if you reduce an image to 16 colors per channel, for each pixel in the image the Posterize node will examine the value of the red channel and reassign that value to the nearest red value in a predetermined set of 16 available reds. Then it will do the same for the green channel, substituting the nearest green value in a predetermined set of 16 greens, and so on. The resulting output image will have a maximum of 16 different values assigned to each channel.

The Posterize node accepts one or two inputs. The second, optional input is used for a mask image. For more information, see Using Mask Inputs in chapter 7.

Posterize Parameters

Output Colors

The Output Colors parameter specifies the number of colors per channel to use for the output. The default is 16 colors per channel for 8-bit inputs, 4096 for 16-bit, and 0.0625 for floating point.

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (such as A for Alpha).



Rank Node

Rank node icon. The Rank node is a versatile filter that is commonly used to suppress noise. The Rank node is a neighborhood operator; that is, the values of neighboring pixels influence the output value of the pixel being processed. Rank sorts the pixels in the sample area and picks one to use for the value based on its ranking in the sort list. The way the pixels are sorted depends on the type of rank operation selected.

The Rank node enables you to specify parameters that affect how each pixel is processed, including

Note:

 

To remove film grain, you may prefer to use the Degrain Node instead of Rank. Another option for reducing noise in still imagery is the Time Blur Node.

The Rank node accepts one or two inputs. The second, optional input is used for a mask image. For more information, see Using Mask Inputs in chapter 7.

Selecting a Noise Reduction Operation

The choice of filter operation to use for noise reduction depends on the degree and character of the noise. As a general guideline, it is best to use the option that will create the fewest image artifacts and still produce an acceptable level of noise reduction.

To remove spot noise, "Threshold Replace (with avg)" is effective. For more information about this option, see the Threshold parameter description.

If the noise problem is more extensive, try using "Remove Bright Noise (maximin)" or "Remove Dark Noise (minimax)":

For more comprehensive noise reduction, before resorting to the Median operation, try using "Average of Maximin and Minimax." As the name implies, this operation calculates both a maximin and a minimax for each pixel and uses the average of the two as the output value.

Note:

 

For the best result with noise reduction filters, specify Cross for the filter shape. See the Filter Coverage parameter description for more information.

Rank Edge Operators

The Rank Operation parameter includes two options for modifying edges: "Min Pixel Value (Erode)" and "Max Pixel Value (Dilate)." If you need to shrink and grow edges with subpixel accuracy, however, use the Erode Dilate Node in chapter 15 instead.

Rank Parameters

Operation Menu

The Operation menu is used to specify the type of operation to be performed by selecting one of the following options:

Filter Coverage

The Filter Coverage parameter provides two choices for defining the shape of the operation area: Box and Cross. (The size of the area is specified in the Filter Size parameter.)

Box: This option specifies a square grid of pixels. Box is usually the best choice for edge operations such as Min Pixel Value and Max Pixel Value.

Cross: This option specifies a cross-shaped area consisting of a horizontal and a vertical line of pixels, with the two lines intersecting at the pixel currently being processed. It has a more subtle effect than using Box. Try the Cross option first when using the noise suppression operations as it may reduce unwanted blurring while still proving effective at removing noise.

Filter Size

The Filter Size value determines the size of the operation area--the neighborhood of surrounding pixels that will be used to calculate the output value of the central pixel. The parameter value is expressed as a percentage of total image width.

Threshold

This parameter becomes active when "Threshold Replace (with avg)" is chosen from the Operation menu. Threshold Replace is a good choice for removing spot noise without introducing excessive blurring to the result. If too much detail is lost, try adjusting the Threshold value to bring it back.

The Threshold Replace operation calculates the average of all the pixel values in the operation area and compares this average value to the value of the central pixel (the pixel currently being processed). If the difference between the two is greater than the threshold value specified in the Threshold parameter, the value of the central pixel is replaced by the average value.

Rank

This parameter becomes active when "Specify Pixel Rank" is chosen from the Operation menu. The Pixel Rank operation sorts, or ranks, each pixel in the operation area by value, from lowest to highest, and assigns the value of one of these pixels to the pixel currently being processed.

The pixel to use for the value is determined by its rank, in a range of 0-1, which you specify in the Rank parameter. For example, if you specify 0.5, the median pixel value in the ranking is assigned as the output pixel value.

Border Style

When using a neighborhood operator, the pixel currently being modified is in the center of a grid of pixels that defines the operation area. Therefore, when processing a pixel that borders the image (or when the operation area is sufficiently large), there will not be adjacent pixels on all sides to contribute values to the calculation.

The Border Style parameter enables you to specify where the node will obtain the values it will use to fill the empty cells in the grid as it processes each border pixel. Select one of the following options from the menu:

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (such as A for Alpha).



Sharpen Node

Sharpen node icon. The Sharpen node enables you to enhance the detail in an image, effectively sharpening it. You can choose from a number of different methods, including several convolution filters and frequency analysis.

The best method to use will depend on the nature of the image being sharpened. The default method, a high pass filter, will be satisfactory in many cases. If it is not, try adjusting the Mix Amount parameter value. If this doesn't give you the result you want, experiment with the other options in the Method menu.

The Sharpen node accepts one or two inputs. The second, optional input is used for a mask image. For more information, see Using Mask Inputs in chapter 7.

Sharpen Parameters

All of the methods available in the Sharpen node use the Mix Amount parameter value to control the level of sharpening. The effect of the Statistical Difference and Frequency methods can also be controlled using one or more parameters in the Advanced menu.

Method

Select the method you want to use to sharpen the image from the Method menu:

The High Pass methods are convolution filters that modify each pixel in turn based on the values of surrounding pixels. Each high pass filter uses a different kernel to weight the contribution of these pixels:

High Pass One

High Pass Two

High Pass Three

0

-1

0

-1

-1

-1

1

-2

1

-1

5

-1

-1

9

-1

-2

-5

-2

0

-1

0

-1

-1

-1

1

-2

1

High Pass Two tends to enhance edges more than High Pass One or Three. (For a detailed explanation of convolution kernels, refer to How Convolve Works.)

The Statistical Difference method often does a good job of preserving detail. It calculates the standard deviation of a pixel area and examines the difference between the standard deviation and the actual pixel values to determine how to add or subtract values from the pixel being modified.

In addition to the Mix Amount, this method also uses the Gain parameter value to control the output. (Expand the Advanced parameter group to access Gain.)

CineSharpen is a Cineon sharpening filter that performs a specialized type of unsharp mask operation. (For an overview of the steps involved in an unsharp mask operation, see the description of the Unsharp Mask Node.)

The Frequency Analysis methods sharpen the image by analyzing the high-frequency part of the signal, which tends to include important image detail, like edges or small features (as well as noise). The high frequency component is separated out, smoothed if possible to remove extra noise, and then added back into the original image. Because several filtering steps are performed, the Advanced parameters must be set appropriately for the image being sharpened.

Two of the frequency analysis methods also perform a grain-filtering step that is done before the actual sharpening:

Using Frequency Analysis

Start by expanding the Advanced parameter group and setting the Noise Threshold parameter, which sets the threshold for the high frequency signal being analyzed--anything above the threshold is considered content (image detail) and anything below is considered noise and removed.

The next step is to specify how much of the "cleaned up" high frequency signal gets added back into the original image. Examine the sharpened image in the Image Viewer and adjust the Mix Amount and Exponent parameters until you see the result you want.

Higher values mean more sharpening for both of these parameters. The difference is that the Exponent is used to concentrate the sharpening effect in the higher frequencies (i.e., edges) or spread it out over the entire image.

Note:

 

For the most detailed explanation of frequency analysis, see the description of the Degrain Node.

Kernel Size

For the high pass sharpening filters, the Kernel Size menu is used to specify the size of convolution kernel used in the sharpening operation; that is, to specify how many surrounding pixels are examined as each image pixel is calculated. The larger the convolution kernel, the more pronounced the effect.

For other sharpening methods, however, the convolution kernel used actually performs a blur. This is an initial step in the operation that helps identify image detail, which is the difference between the original image and the blurred image.

You can choose from a 3 x 3, 5 x 5, 7 x 7, or 9 x 9 kernel, unless you have selected High Pass One or High Pass Three in the Method menu. For these two sharpening operations, which by definition use a 3 x 3 kernel, the Kernel Size method is disabled.

Mix Amount

This parameter specifies the amount of sharpening. Lower values produce less sharpening and higher values, more (from no sharpening at 0 to a very harsh result at 1).

Advanced Parameters

The Advanced parameters, Gain, Exponent, and Noise Threshold, are activated when a frequency analysis option is selected from the Method menu. In addition, the Gain parameter is activated when the Statistical Difference method is selected.

Gain

Increasing the Gain parameter may enhance detail, up to a point; after that, the image will begin to look harsh, or over-sharpened.

Exponent

The Exponent parameter, in conjunction with the Mix Amount parameter, modifies how much of the high frequency signal falling above the Noise Threshold parameter levels will be added back into the original image.

The Exponent differs from the Mix Amount parameter in that the exponent is a power function that controls the slope of the nonlinear curve that represents the frequency distribution. This means basically that it controls the steepness of the slope:

Noise Threshold

The Noise Threshold parameter sets a threshold for filtering the high frequency signal before it is added back into the original image. Larger values will remove more of the original signal--they will remove more noise, but also more picture detail. Smaller values will preserve detail, but allow more noise through.

The Noise Threshold parameter can be expanded to adjust the value separately for each channel. This is most applicable to filmed imagery, as each film layer responds differently to light. In particular, the blue layer typically has much more noise than the green layer.

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (A for Alpha, e.g.).



Text Node

Text node icon. The Text node enables you to add text to an image to create titles and effects for final output or, more commonly, to add slates and frame numbers to temporary renders. You can specify font characteristics, color, and opacity, as well as rotate, scale, and move the text layer.

The Text node accepts one or two inputs. The second, optional input is used for a mask image. For more information, see Using Mask Inputs in chapter 7.

The output of the Text node will be the same number of channels as the input image, with the text composited into all channels specified in the Channel Select parameters.

Text Parameters

The parameters in the Text Node Panel are used to generate the text and specify the font, color, and opacity in which it will be displayed.

You can also adjust the size and position of the text by using the appropriate Node Panel parameters or by using the interactive overlay in the Image Viewer.

Text Field

Use the Text field to enter and edit the text. As you type, the field will scroll automatically if the text extends past the visible edge. When you press the Enter key, the text will appear over the image in the Viewer, at least wherever it fits within the image frame.

To break the text into multiple lines (to type a line break), press Shift-Enter while the cursor is in the text field.

Using Global Variables in the Text Field

The default text in the field is "Frame:$F4," where $F is a global variable that returns the current frame number. The numeral 4 appended to the variable specifies that the frame value be padded with zeros as necessary to generate a 4-digit number. So, assuming that you are at frame 1, the text in the image will read "Frame:0001."

The text node can evaluate $F and any other global variable you define. No special syntax is necessary--just type in the variable. If you want the variable itself to appear, however, type a backslash (\) to prevent the global from being evaluated.

For example, typing $F will display the number "1" in the image (assuming that to be the current frame number); however, typing \$F will display "$F" in the image. (To display the backslash character, you would type it twice.)

Font Menu

The Font menu specifies the font in which the text will be displayed. You can choose regular, bold, or italic fonts in Baskerville or Nimbus Roman. You can also choose regular or bold sans serif and monospaced fonts: Nimbus Sans and Nimbus Mono. The menu also includes Brush Script, a calligraphic script font, and Liquid Crystal, which mimics LCD readouts.

Tip:

 

Use a monospaced font such as Nimbus Mono to display frame numbers in the Text node. The equal width of all characters in monospaced fonts keeps the changing values from seeming to jump from frame to frame.

Adding Fonts to the Font Menu

You can use any fonts available to your system by adding their location to the Font Search Path in Edit > Preferences > File Paths. The Font menu in the Text node will update to include the additional fonts.

You could add fonts to the default font directory; however, this is not recommended as this directory could be overwritten when RAYZ is updated. Instead, use the pipe character (the vertical bar: |) to add a separate path in which RAYZ should also search for fonts.

 See accompanying caption for image description.

Fig. 19.3 You can use the pipe (|) character to add paths to the Font Search Path parameter. This example specifies that RAYZ search in the default directory and in "/usr/lib/fonts."

Character Size

This parameter specifies the size of the characters. The default value is a small percentage of the full size of the input image, expressed in units approximating points (used in typesetting).

Extra Kerning

Use the Extra Kerning parameter to increase the space between letters.

Extra Leading

Use the Extra Leading parameter to increase the space between lines of text.

Render Color

Render Color specifies the color of the text, which is white by default, using the color parameters that are common to many nodes in RAYZ. If you need more information, these controls are described in detail in the section on Using the Color Parameters in chapter 14 in the Color node description.

Opacity

The Opacity parameter specifies the opacity of the text layer over the image in a range of 0-1. By default the opacity value is set to1; that is, the text is totally opaque.

Transform Parameters

The Rotate, Scale, Translate, and Pivot parameters control the position and orientation of the text layer only, relative to the input image. They can be adjusted numerically in the Node Panel, or you can use the text transform overlay in the Image Viewer to adjust them interactively.

These parameters are identical to the spatial transformation parameters used in a number of nodes in RAYZ. For detailed information about their use, refer to the description of the Transform Node in chapter 17.

Channel Select

Use this parameter to specify which image channels will be affected by the node; that is, to which channels the text will be applied. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (A for Alpha, e.g.).



Time Blur Node

Time Blur node icon. The Time Blur node enables you to modify each pixel in an image by averaging the values of corresponding pixels across a range of frames. This means that Time Blur only affects those pixels that change from frame to frame.

Time Blur can be used to create various trailing or strobe effects. Depending on the nature of the movement in a shot, this node can also create an effective motion blur because it blurs moving elements without blurring the background. This characteristic means that Time Blur is excellent for noise reduction on background plates without moving elements.

Using Time Blur

You can specify the following options for the Time Blur operation:

You may want to experiment with different settings to get a feel for the effect they will have on your imagery. For example, try using the Triangle filter with the Past Only setting in the Direction parameter to create a diminishing trail behind a moving object.

Time Blur Parameters

 See accompanying caption for image description.

Fig. 19.4 Examples of the effect of various filters on a sequence of images, each of which displays the current frame number. The Filter Size is 3 and the current frame is 5.

Kernel Size

The Kernel Size parameter enables you to specify the size of the filter in frames. The default value is 3, which is the minimum size.

You can enter any odd integer value in the range, which is constrained to 3-31. (If you enter an even value, the node will actually use the next odd integer.) The odd value is stipulated because there must be a center frame to reference by other parameters that modify the filter.

Note:

 

The higher the Kernel Size value, the longer the node takes to process, since the data from that number of input frames must be accessed and calculated for each frame of the input as it is modified.

How Start and End Frames Are Processed

When the first frame of the input sequence is being processed, no previous input frame exists to use as a segment of the convolution filter. In such cases, the image data from the first frame of the input sequence is used as the value for all filter segments that would otherwise use the values from previous input frames.

The same holds true when the final frame of the input is being processed: the data from the last input frame is used for all filter segments that would otherwise use the values from subsequent input frames.

Kernel Shape

The frame averaging used in the Time Blur operation is weighted in proportion to the shape of the filter specified in the Kernel Shape menu. You can choose Box, Triangle, Cubic, Quadratic, or Gaussian (the default).

For example, the box filter (constant function) averages the values of each frame evenly, so that each contributes in equal measure to the result, while the triangle filter (linear function) performs a weighted average of the values in each frame, with the center frame contributing most.

The default Gaussian filter uses a bell shaped curve to weight the distribution. The Cubic or Quadratic filters often produce the most subtle effect.

Frame Offset

This parameter allows you to specify an offset from the center of the filter. If you set the Frame Offset parameter to a value other than the default value of 0, the current frame (the frame being modified) is no longer the center segment of the filter. The range of valid Frame Offset values is -15 to 15, which corresponds to the maximum Kernel Size value of 31.

It may be helpful to visualize the offset as sliding the frames of the sequence back and forth under a stationary window (the filter), as dictated by the offset value entered.

 See accompanying caption for image description.

Fig. 19.5 Examples of the effect of negative and positive Frame Offsets on a sequence of images of frame numbers. The Filter Size is 3 and the current frame is 5.

Direction

The Direction parameter enables you to specify that only part of the filter be used in the convolve operation. The Direction menu enables you to specify Past and Future, Past Only, or Future Only. The terms past and future in this case refer to the direction in time from the current frame.

Note:

 

When Past Only or Future Only is selected, which eliminates one or more frames from contributing values to the filter operation, the results are normalized to prevent overall changes in brightness in static areas of the frames. This ensures that only pixels that change from frame to frame are modified.

 See accompanying caption for image description.

Fig. 19.6 Examples of the effect of Direction settings on a sequence of images of frame numbers. The Filter Size is 3 and the current frame is 5.

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (such as A for Alpha).



Unsharp Mask Node

Unsharp Mask node icon. The Unsharp Mask node simulates a technique used in traditional photography to sharpen an image. Unsharp Mask works by increasing the contrast between adjacent pixels in those areas with the greatest visual detail.

The process involves three steps:

  1. A low-pass convolution filter is used to blur the source image.
  2. The blurred image is subtracted from the source image. In effect, the blurred image is used as a mask to perform edge detection on the original image (hence the term "unsharp mask").
  3. The result of the unsharp mask operation is added to the source image.

Unsharp Mask Parameters

The Unsharp Mask parameters enable you to control the blur level of the operation performed in the first step and how much of the unsharp mask is added to the source image in the third step:

Mask Amount

The Mask Amount parameter is used to specify the extent to which the source image is modified by the unsharp mask to generate the sharpened output image. The parameter range is 0-1. The default value of 1 adds 100 percent of the value of the mask to the source image, while a value of 0 would result in no change to the output image.

Kernel Size

The Kernel Size parameter controls how strong the unsharp mask will be by specifying the size of the convolution kernel used for the blur. The parameter range represents approximately 5 percent of the total width of the input image, although the upper end of the range is unconstrained. The default Kernel Size value is equivalent to 1 percent of the total width.

Kernel Shape

The Kernel Shape menu specifies the distribution function to use to weight the kernel values; that is, the extent to which surrounding pixels will contribute to the blur performed as part of the unsharp masking (see step 1 above). The default function is Gaussian, the familiar bell-shaped distribution curve. The other choices are Box (constant), Linear (triangle), Quadratic, and Cubic.

Kernel Type

The Kernel Type parameter allows you to choose whether the node should use Integer or Floating Point math for the calculation. Floating Point is the default, and precision restraints make it inefficient to compute Cubic or Gaussian functions using integer math.

Border Style

The pixel currently being modified is in the center of a matrix of pixels that contribute to the effect. This means that when processing a pixel that borders the image, or when the operation area is sufficiently large, there will not be adjacent pixels on all sides to contribute to the calculation.

The Border Style menu specifies where the node will get the values it will use to fill the empty cells in the matrix as it processes each border pixel:

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (A for Alpha, e.g.).



Vector Blur Node

Vector Blur node icon. The Vector Blur node is used to create directional blurs; that is, blurring along a specified vector. Vector Blur is most often used to create motion blurs.

The Vector Blur node blurs each pixel in an image based on parameter values that you set to control the number and location of neighboring pixels to be used in the blur computation, as well as the weight of the contribution of each neighboring pixel value to the blur effect.

The Vector Blur node computation is essentially a convolution whose kernel, or matrix of cells, consists of a single row of cells with the pixel to be convolved in the central cell of the row and neighboring pixels in the cells on either side. (For a general explanation of the convolution process, see the description of the Convolve Node.)

Pixels around the border of the image, which do not have adjacent pixels on all sides, are mirrored; that is, they are treated as if there were adjacent pixels on all sides by mirroring the values of the inner adjacent pixels.

Using Vector Blur

To control the direction of the blur effect, you specify the vector used to define the kernel. The vector can be thought of as a line drawn on the image, with the current pixel to be blurred in the center of the line.

You can control the following, using the indicated Node Panel parameter:

Using a Mask Input with Vector Blur

The Vector Blur node accepts one or two inputs. The second, optional input is used as a mask image for the blur. The mask input controls for Vector Blur are slightly different than they are for other nodes, however, because an extra option is offered.

In addition to selecting "On/Off" or "Mix," as described in Using Mask Inputs in chapter 7, you can also select a third type of action: "Direction." The Direction option uses the mask image to determine the magnitude and direction of the effect.

The direction is determined by using two of the mask input channels to represent the x and y coordinates of a vector, in effect generating a surface normal (a vector perpendicular to the surface) for each pixel. In fact, you can use the output of the Bump Map Node as the mask input to Vector Blur.

When Direction is selected, therefore, the associated Channel menu for the mask input is deactivated. If the mask input contains more than two channels, the Vector Blur node will automatically select the red and green channel data to use.

Vector Blur ParametersMagnitude

The Magnitude parameter enables you to specify the length of the vector used to define the blur in a range of 1-50, with a default value of 10. You set this parameter to specify the general level of blur, with higher values resulting in a greater blur effect.

Angle

The Angle parameter enables you to set the direction of the vector used to define the blur. This parameter, along with the Extents parameter, is used to specify the apparent direction of motion in a motion blur.

You set the Angle parameter value in the range of 0-360 degrees. The default angle is 0, which equates to a horizontal left-to-right direction for the blur effect.

Extents

The Extents parameter enables you to "clip" the function curve used to control the blur. In effect, this eliminates the contribution of any pixels in the kernel that fall outside the boundaries you set in the following range:

The Extents parameter can be used to help create the effect of motion in a motion blur by enabling you to specify that only a portion of the pixels in the kernel be used in the computation.

For example, to create the effect of an object moving left to right you could set the Angle to 0 and the Extents parameters to 0 (left field) and 1 (right field). This would eliminate the contribution of all pixels in the kernel that fall to the left side of the central pixel.

Extents Values in Relation to Angle of Vector

As the selected vector deviates from 0 degrees (the default), you can think of it as rotating counterclockwise to determine which edge of the vector is represented by the -1 value, and which by the 1 value. For example, for a 90-degree (vertical) vector, a value of 1 represents the top edge of the vector and -1 represents the bottom edge.

Filter Type

The Filter Type menu specifies the type of filtering to use to weight the distribution of the blur effect. For example, if a Box filter is used, each pixel contributes in equal measure to the blur effect. With the Triangle filter, the central pixels contribute most heavily to the result. The Gaussian filter, on the other hand, is a bell-shaped distribution function.

When some of the other filters, such as Mitchell or Sinc, are selected, additional parameters become active that are used to modify these filters. They are described in more detail in the section on Filtering Transformations in chapter 17.

Channel Select

Use this parameter to specify which channels of the input image will be processed by the node. By default, all channels of the input image are selected. To deselect a channel, press the button labeled with that channel letter (such as A for Alpha).



Vector Warp Node

Vector Warp node icon. The Vector Warp node will warp an image using data from a second input image. Vector Warp can be used to create animated displacements, such as ripples or wakes, and other distortion effects.

The Vector Warp node requires two inputs. The top input is the image to be vector warped, and the bottom input must be a two-channel floating point image, such as the output produced by the Bump Map Node. The vector data in the bottom input is used to control the displacement of corresponding pixels in the top input image.

Vector Warp Parameters

Magnitude

The Magnitude parameter is used to adjust the magnitude of the effect by specifying a multiplier value for the vector data in the bottom input, in a range of 0.5 to 5. Larger values create greater distortion.



Xpresso Node

Xpresso node icon. The Xpresso node is used to program custom effects by writing mathematical expressions that define each pixel in each channel of the output image.

All pixels and channels of the input imagery can be referenced in the expressions you devise, and the Xpresso node can have as many inputs as you choose. Each time you connect an input to Xpresso, another input connector is automatically created.

Xpresso must have at least one input, which is used to set the frame size and number of channels of the output, even if the input is not referenced by the expression.

When inputs of different sizes are connected to Xpresso, their active areas are merged to create the active area used by Xpresso to perform the node operations. The size of the output frame, however, is determined by the first (top) input to the node. The number of channels in the output is also determined by the top input.

When inputs are different bit depths, the lower are promoted to the highest bit depth among them. When all inputs consist of integer data (that is, 8-bit or 16-bit imagery), expressions are calculated in integer. Floating point inputs are always calculated in float. If the inputs are mixed, all values are converted to float. Integer inputs are also converted to floating point when a function that requires float values (sin, e.g.) is called.

Tip:

 

Use the "Save As" command in the Presets menu in the Xpresso Node Panel to save an expression under a unique name, which will then appear in the Presets menu of every Xpresso node. You can create a library of presets that you can select in any Xpresso node, without remembering and retyping the expression each time.

How the Xpresso Node Works

The Xpresso node begins processing at the first pixel of the first channel and continues until all pixels in the channel have been addressed and assigned a value. Then the Xpresso node addresses the subsequent channels in turn until each pixel in each channel has been assigned a value.

You define this process of assigning values to pixels by typing a mathematical expression into the Expression field in the Xpresso Node Panel.

Xpresso expressions use the following variables, functions, and operators. The section on Guidelines for Using Xpresso covers syntax and provides some examples.

System Variables

The following system variables are available to the Xpresso node:

X

the maximum x value, or the width of the picture

x

the current x value

Y

the maximum y value, or the height of the picture

y

the current y value

Z

maximum value (at 8 bits per pixel, this is 255; at 16 bits per pixel, this is 65,535; if you are using floating point data for pixel representation, this is 1.0).

SX

scale in current X specified by Image Viewer Size menu (scales expression when using integers to work with medium and low proxies; SX is a fractional, or float, value)

SY

scale in current Y specified by Image Viewer Size menu (scales expression when using integers to work with medium and low proxies; SY is a fractional, or float, value)

radius

distance from center of image (X/2, Y/2) to current pixel(x, y), measured in pixels; radius value is fractional (123.4, e.g.)

RADIUS

maximum radius, that is, distance from center of image (X/2, Y/2) to image edges (X, Y)

angle

angle, in degrees (from 0.0 to 360.0, counterclockwise), of vector from center of image to current pixel

You can also use the $F global variable, which represents the current frame number.

Functions

The following functions are available in the Xpresso node:

abs

clamp

cos

rand

acos

contains

max

sign

and

cos

min

sin

angle

deg

odd

sqrt

asin

even

pow

tan

atan

hypot

pulse

wrap

atan2

if

rad

rand

between

log

radius

 

Operators

The following is a list of operators that can be used in the Xpresso node. The order of precedence (the order in which they are evaluated in the expression) is similar to the C programming language.

conditional

condition ? true : false
if(
condition , true , false )

comparison

== != > < >= <=

arithmetic

+ - * / % ** (e.g., base expression**exponent expression)

Note:

 

Due to inherent round-off errors, you should avoid comparing floating point numbers for equality: do not use the "==" operator with floats.

Guidelines for Using Xpresso

An Xpresso expression tells RAYZ what values to use for each pixel of each channel in the output image. You can specify any values you choose for the output, and any pixel or channel in any input image can be referenced and modified to generate the output.

The output image is defined as buffer 0, the first (top) input to Xpresso is 1, the second, 2, and so on. To identify the number as referring to one of these image buffers, it is enclosed in brackets: [0] for the output or [1] for the top input.

Assume that there is one input to the Xpresso node. To set the RGB channels so that the output image is equal to the input image, you could enter the expression [0] = [1] .

Similarly, to set the output to black, you could type [0] = 0 . And to set the output to white, you could type [0] = Z , since Z is the variable used to represent the maximum value of the colorspace.

Since setting the output buffer is the whole point of using Xpresso, however, it can be treated as implied behavior, which simply means that the expression [0] = [1] can be shortened to [1] and the expression [0] = 0 can be shortened to 0 .

You can use more than one expression to define the output buffer. Expressions must be separated by a semicolon (;).

Addressing Pixel Coordinates

To address pixel coordinates, use the form [n,x,y]. For example, [1,x,y] represents each pixel in the first input image. To flip the input image, you could enter this expression:

[0, x, y] = [1, y, x]

This expression could be also shortened to [0] = [1, y, x] or even to just [1, y, x] .

To shift the output image, say, 100 pixels to the right and 200 pixels down, use this expression:

[0, x + 100, y - 200] = [1, x, y]

As in previous examples, this could be shortened:

[0, x + 100, y - 200] = [1]
Addressing sub-pixels

To address fractional pixel values, which will be interpolated bilinearly, use braces {curly brackets} instead of square brackets. For example:

{0, x + 1.333, y - 2.333} = [1]

Another example might be:

[0] = {1, sqrt(x), sqrt(y)}

Addressing Channels

To address a particular channel of an input or the output, specify the channel number: [n,x,y,c]. The red channel is 0; green is 1; blue is 2, alpha is 3, and so on. To use the red channel of the first input to fill all channels of the output, for example, you would enter:

[1, x, y, 0]

To use all channels of the input in the output, but modify only one of the channels, start by specifying that the output should equal the input and then use another expression to modify a particular channel.

For example, the expression [1] * 0.8 would darken the input image by 20 percent. To darken just the red channel, however, enter this instead:

[1]; [0,x,y,0] = [1,x,y,0] * 0.8

Conditionals

To specify that only those pixels in a certain value range or location are modified, you can use conditional statements.

To darken the image only in a vertical strip running down the left side of the image, for example, use this expression:

[1] = x <= 200 ? [1] * 0.8 : [1]

This instructs Xpresso to check the x value of input pixel: if it is less than or equal to 200, multiply the color value of that pixel by 0.8; if it is not, use the color value unchanged.

You could get the same result by using the alternate syntax for conditional statements:

[1] = if(x <= 200, [1] * 0.8, [1])

To darken a vertical strip down the middle of the image, say from pixels 300 to 400 in X, nest another conditional statement in parentheses:

[1] = x >= 300 ? (x <= 400 ? [1] * 0.8 : [1]) : [1]

This instructs Xpresso to check the current pixel's x value to see if it is greater than or equal to 300. (If that is true, check to see if it is less than or equal to 400; if so, multiply the input color value by 0.8; if not, use the input color value unchanged.) If the x value of the current pixel is not greater than or equal to 300, use the input color value unchanged.

Here is an example that clamps the color value in the blue channel of an 8-bit input image [1,x,y,2] to a maximum of 128:

[1]; [0,x,y,2] = ([1,x,y,2] > 128 ? 128 : [1,x,y,2])

As in some of the earlier examples, the first expression [1]; copies the input image to the output buffer, and it is separated from the next expression by a semicolon.

Note also that the color value (128) is expressed in the colorspace units of the input image rather than in generic floating point notation (0.5).

Xpresso Parameters

Expression Field

This is the field in which you enter expressions. The default expression is "Z," which generates a white image.

To type a line break, hold down the Shift key as you press Enter. For long, complex expressions, you may prefer to maximize the Node Panel to increase the size of the text box.