Label mapping using a Stencil mask

If you want to apply a totally opaque label to a surface, a transparency mask is not necessary and you can apply the label as a simple File texture. However, if any area of the texture map must be transparent so that the surface color shows through, then a Stencil texture is a good choice as it allows you to easily create the required transparency mask as well. The transparency mask is automatically positioned in the same location as the texture map.

For this example, the white background of the label must be transparent to allow the underlying surface color to show through. The only portion of the texture map that will show in the final rendered image is the lettering. Creating such a transparency mask can be accomplished in either of two ways:

Example

The following example uses a black and white mask file called Logo.

  1. Select Edit New Shader from the Multi-lister to create a new shader.

  2. Double-click the shader icon to display the shader's editor.

  3. Choose an appropriate Shading Model and set any other shading parameters required to properly represent your underlying surface. This includes selecting an appropriate shader color. To do so, click the arrow to the right of the Color heading to display the Color Editor.

  4. Select Shader Assign Shader to assign the shader to the active surface.

Applying the Stencil Texture

  1. Click the Map... button to the right of the Color slider to display the Texture Procedures window.

  2. Click the Stencil texture icon.

    When you select the Stencil texture, the Texture Procedures window automatically closes, a texture icon is displayed in the Multi-Lister and the Stencil editor is displayed.

  3. In the Stencil editor, click the Map... button next to the Mask parameter.

  4. Select the File texture from the Texture Procedures window.

  5. Open the Stencil editor (click the arrow at the top left of the File Texture Parameters editor).

  6. Click the Map... button next to the Image parameter.

  7. Select the File texture again from the Texture Procedures window. Once the Mask file has been specified, it is mapped onto the surface in the exact location of the previously placed texture map label.

    As shown in the following, the texture icon no longer displays the white background area of the texture map. The white area of the Mask file (being transparent) allows the original shader color to show through.

Adjusting the Mask Level and Blur using File Texture Parameters

Some File texture parameters applied to the mask are very useful (such as Blur parameters).

For instance, the Rgbmult value for the mask texture controls the overall transparency of the Stencil texture (set in the Color Balance section of the editor. See Common Surface Texture Parameters for details)). The Bluroffset on the mask texture can be used to control the softness of the mask (small values around.01 are most useful).

Using Qk Render to Preview

With the texture map label and transparency mask in place, you can preview the result using Render Quick render. To stop the Quick Render before it is complete, press the Esc key.

Tip: It is recommended that you open the associated Quick Render option box (Render Quick render-) and increase the Shading Frequency value to better visualize the texture map placement and effect of the transparency mask. The Shading Frequency option accepts a value in the range of 0 through 10. The higher the value, the slower the quick rendering will be, but you will see considerably more detail in the quick rendered image as the frequency value is increased. If a value of 10 is required, it may be faster to do a full render of the object.

Stencil Chroma-keying (Key Masking)

When creating a transparency mask using the Color Chroma Keying technique, a mask texture is not necessary. You are actually creating the mask file when you use the Color Chroma Keying procedure.

When creating a mask file from a color map, the areas and degree of transparency are not clearly defined. Chroma keying enables you to define a color range (chroma) to be used for transparent areas of the mask as described in the following.

Important! Remove the Mask File

Before proceeding with chroma keying, you should remove any mask file that may have been applied when working through this example. To do this, type a space for the file name in the Image field.

Using the HSV Color Key parameters

Select the Stencil texture icon in the Multi-lister. To display the HSV Color Key parameters, click the black arrow to the left of the HSV Color Key heading.

  1. Click to set the Key Masking option ON.

  2. Click the arrow to the right of the Color Key heading to display the Color Editor, then click the Grab button.

  • An eye dropper is displayed in the Color Editor. Drag the cursor to the Multi-lister, position it somewhere on the white background of the texture map in the texture map icon and click the left mouse button. Notice that all white areas of the pix file become transparent and allow the base shader color to show through.

    This same technique can be used to grab any color from a texture map image and make it transparent. Once a color has been selected, the grab button is automatically toggled OFF and you have to re-select it for each subsequent color grab.

    You can make a range of colors transparent by carefully modifying the Hue Range (hue), Sat Range (saturation), Val Range (value) and Threshold sliders, which are all components of the HSV Color Key parameter set. The Positive Key parameter enables you to invert the mask, which means showing only the colors specified through the Color Key and HSV range.

    Tip

    You may want to close all editor windows when done to only see the shader icon and its associated editors. To do this, click the close arrow to the right of the shader, texture or light name in the Multi-lister.





    aliasdocs@aw.sgi.com
    Copyright © 1997, Alias|Wavefront, a Silicon Graphics Company. All rights reserved.