You can use gradients to create a number of different shading effects. Besides using them to texture objects, you can use gradients to drive other shaders’ parameters. For example, gradients are commonly used to blend two textures together.
You can add gradients to your scene objects using the gradient texture shader or the gradient mixer shader. Both gradient shaders use the same gradient control and both allow you to set separate color and alpha gradients. You can create gradients of up to eight colors or alpha values.
|
A particle gradient shader, which applies a color gradient to particles based on their age, is also available. For more information about the particle gradient shader, see Rendering Particles and Fluid in the Simulation Basics guide. |
• The gradient texture shader applies a gradient texture to the surface of the selected object(s).
• The gradient mixer shader accepts a scalar or vector input that drives the color gradient that it outputs. This allows you to create gradients based on, for example, distance, vector coordinates, or in the case of the image shown below, incidence.
For more information on how to use each gradient shaders’
parameters, refer to its help topic by clicking the Gradient texture
or mixer shader property editor’s
icon.
To connect a gradient texture or mixer shader to an object, use one of the texturing methods described in Three Basic Texturing Methods.
Once the gradient shader is applied, open its property editor and define the gradient, as described in the following section.
Using the Gradient Controls to Define a Gradient
The gradient slider, in the Gradient texture or mixer shader’s property editor, is where you create and adjust the gradient. It displays the gradient left-to-right from beginning (position 0.00) to end (position 1.00). By default, a new gradient shader displays a six-marker multi color RGBA gradient (on the RGBA Gradient tab) and a two-marker black-to-white alpha gradient (on the Alpha Gradient tab).
Although the following procedures explain how to define an RGBA gradient on the RGBA Gradient tab, the process for defining an alpha gradient on the Alpha Gradient tab is nearly identical. Defining an alpha gradient is described in Activating the Alpha Gradient.
|
You can start out by setting the gradient to one of the available presets by clicking the corresponding Preset button in the property editor. Presets are available for both the RGBA and alpha gradients. |
To add color markers to the gradient
• Click anywhere on the gradient slider to add a new color marker. By default, the marker assumes the gradient’s color at the click-point. You can have up to eight markers on a gradient.
When you add a color marker, interpolation markers are automatically inserted at the midpoint between the new marker and adjacent markers.
To edit markers’ RGBA values
1. Click any marker to select it.
2. Use the Color sliders (or other color controls) to adjust its color.
For more information on defining colors, see Defining Color Properties in the Interface and Tools guide.
To adjust color marker positions on the gradient
• Click any color marker to select it and do one of the following:
- Drag the marker to a new position.
- Enter a new position value in the Pos text box. Position values can range from 0.0 (the beginning of the gradient) to 1.0 (the end of the gradient).
To adjust the blend between two markers
• Click the round interpolation marker between two color or alpha markers to select it and do one of the following:
- Drag the interpolation marker to a new position.
- Enter a new position in the Pos text box. Interpolation marker position values can range from 0.05 to 0.95.
To delete color markers from the gradient
• Right-click the color marker and choose Delete Marker from the menu.
To change the gradient’s interpolation
• Click the interpolation button (marked Cubic or Linear, depending on the selected interpolation type) to switch between cubic and linear interpolation.
Cubic interpolation creates smoother transitions between gradient colors, while linear interpolation results in sharper transitions.
To select a gradient type
• From the list, select one of the gradients shown below.
|
If you have the alpha gradient active in the Alpha Gradient tab, changing the gradient type for the RGBA gradient changes it for the alpha gradient as well. |
To invert a gradient
• Activate the Invert option to reverse the gradient’s direction—a gradient going from top to bottom goes from bottom to top, and so on.
|
If you have the alpha gradient active in the Alpha Gradient tab, inverting the RGBA gradient inverts the alpha gradient as well. |
To clip a gradient
• Activate the Clip option to prevent the first and last colors in the gradient from appearing outside of their active ranges.
When this option is active, the gradient color is set to black from the beginning of the gradient to the beginning of the first color’s active range and from the end of the last color’s active range to the end of the gradient.
When this option is inactive, the following occurs:
- The first color in the gradient is applied from the beginning of the gradient to the beginning of the first color’s active range.
- The last color in the gradient is applied from the end of its active range to the end of the gradient.
|
If you have the alpha gradient active in the Alpha Gradient tab, clipping the RGBA gradient clips the alpha gradient as well. |
In addition to an RGBA gradient, the gradient shaders allow you to create a separate gradient in the alpha channel. This allows you to vary the gradient’s alpha independently of its color.
For example, you might use a seven-marker RGBA gradient and a two-marker alpha gradient so that the gradient gradually becomes less transparent overall as it transitions from color to color, as shown in the following illustration:
|
Activating the alpha gradient overrides any alpha values that you set for the color markers in the RGBA gradient. |
To define an alpha gradient
1. From the Gradient (texture or mixer) property editor, go to the Alpha Gradient tab and activate the alpha gradient. The default black to white alpha gradient is displayed.
|
You can immediately set the gradient to one of the available presets by clicking the corresponding Preset button. • Black and White: a two-marker alpha gradient that goes from black (alpha value 0) to white (alpha value 1). • White and Black: a two-marker alpha gradient that goes from white (alpha value 1) to black (alpha value 0). |
2. Use the gradient controls to define the alpha gradient the same way that you would to define a color gradient (described [here]).
The difference is that instead of setting color values using color sliders, you set alpha values for each marker using a single Alpha slider.
The rest of the gradient parameters also work the same way for alpha gradients as they do for RGBA gradients.
|
The alpha and RGBA gradients cannot have a different gradient type. Similarly, inverting or clipping the alpha gradient does the same to the RGBA gradient. |
You can animate color/alpha (square) and interpolation (round) markers, on both RGBA and alpha gradients, to vary their colors/alpha values and positions over time.
You can also animate the positions of interpolation markers. You do this by setting keyframes for any given marker’s color, alpha, or position parameters.
As you might imagine, this can quickly become time consuming, which is why the Gradient property editor provides animation tools to key gradient markers for you. The following buttons are available:
|
When you use the Key All and Remove Keys buttons to set or remove keys, only parameters on the current tab have keys set or removed. For example, clicking the Key All button from the Alpha Gradient tab will only set keys for the alpha gradient’s parameters. To key RGBA gradient parameters as well, click the Key All button on the RGBA Gradient tab. |
To animate gradient markers
1. Go to the frame at which you want to set keys.
2. From the RGBA Gradient or Alpha Gradient tab, do one of the following:
- Click the Key All button to key all visible markers in the gradient. Square color/alpha markers’ Color/Alpha and Pos values are keyed, and round interpolation markers’ Pos values are keyed.
or
- Select a square color/alpha marker or a round interpolation marker, and click the Color/Alpha and/or Pos parameter’s animation icon.
To remove the animation on the markers
• From the RGBA Gradient or Alpha Gradient tab, do one of the following at any frame:
- Click the Remove Keys button to remove all keys from all markers’ parameters.
or
- Select a color/alpha marker or a round interpolation marker, go to a frame where you’ve applied a key, and click the Pos parameter’s animation icon.
To reset the marker positions and remove keys
• Click the Reset button.
This removes all keys on the color, alpha, and interpolation markers, puts all markers back in their original positions, and sets them to their original color, alpha, and interpolation values.
Connecting Shaders to Gradient Markers
You can connect shaders to any of a gradient’s color, alpha, or interpolation markers. Color and alpha markers can be connected from the Gradient property editor, while interpolation markers must be connected in the render tree. This allows you to, for example, create a gradient of textures.
To connect a shader to a marker’s color/alpha parameter
1. From the RGBA Gradient or Alpha Gradient tab, click a color/alpha marker to select it.
2. Do one of the following:
- Click the connection icon next to the Color/Alpha slider and select a shader from the menu. This procedure is described in Method 2: Connecting Shaders Using the Property Editor.
or
- Select the object to which the gradient shader is applied and open the render tree (press 7). From the Nodes menu, choose a shader to connect to any marker’s color/alpha parameter. For more information about connecting nodes in the render tree, see Connecting Nodes in the Material and Shader Basics guide.
To remove all shaders from color/alpha and interpolation markers
• From the RGBA Gradient or Alpha Gradient tab, click the Remove Shaders button. Any shaders attached to any of the gradient markers’ Color/Alpha and position parameters are disconnected.
|
Clicking the Remove Shaders button from the RGBA Gradient tab only removes shaders connected to the RGBA gradient’s parameters. Clicking the button from the Alpha Gradient tab only removes shaders connected to the alpha gradient’s parameters. |
SOFTIMAGE|XSI v.6.01