Go to: Related nodes. Attributes.

The Stencil texture lets you take any image input (from a shading network, or a file texture node, say) and map it onto an object. It also lets you mask the input image to control how it covers a surface. Use the Stencil texture to overlay different textures (and control what parts of the texture are visible), or for label mapping.

Normally, Stencil nodes are created automatically by the system when you put a 2d texture map on a node, and specify that it should be a 2d Stencil. The Out Color attribute of the Stencil is connected to the attribute being mapped. The Stencil itself is driven by the new texture map and its placement node. Specifically, the texture's Out Color is connected to the Stencil's Image attribute, and the Placement node drives the Stencil's UV Coord and uv Filter Size attributes. This is all done for you.

Note: The region being stenciled-out will take on the default color of the stencil, not the shader's color.

In the table below, important attributes have their names listed in bold in the description column.

This node is MP safe

Node nameParentsClassificationMFn typeCompatible function sets
stenciltexture2dutility/general:drawdb/shader/texture/2d/stencilkStencilkBase
kNamedObject
kDependencyNode
kTexture2d
kStencil

Related nodes

layeredTexture, envCube, envSphere, envSky, envBall, envChrome, bump3d, uvChooser, bump2d, texture2d, ramp, file, cloth, water, checker, fractal, bulge, grid, mountain, texture3d, projection, cloud, granite, crater, leather, stucco, brownian, solidFractal, marble, wood, rock, snow, defaultTextureList, place2dTexture, place3dTexture

Attributes (16)

colorKey, colorKeyB, colorKeyG, colorKeyR, edgeBlend, hueRange, image, imageB, imageG, imageR, keyMasking, mask, positiveKey, saturationRange, threshold, valueRange

Long name (short name)TypeDefaultFlags
colorKey (ck) float30.0, 0.0, 0.0outputinputconnectablestorable
Color Key is The color to be masked in the texture. The default setting is black. To mask a range of colors, you must also set the Hue/Sat/Val Range parameters.
colorKeyR (ckr) float0.0outputinputconnectablestorablekeyable
The red component of Color Key
colorKeyG (ckg) float0.0outputinputconnectablestorablekeyable
The green component of Color Key
colorKeyB (ckb) float0.0outputinputconnectablestorablekeyable
The blue component of Color Key
edgeBlend (eb) float0.0outputinputconnectablestorablekeyable
Edge Blend controls the sharpness of the edges of the texture. Increase this value to make the edges blend more softly.
hueRange (hr) float0.5outputinputconnectablestorablekeyable
Hue Range controls The range of hues (H) centered on the Color Key color which will also be masked. The valid range is 0 to 1. The default value is 0.5.
image (im) float30.0, 0.0, 0.0outputinputconnectablestorable
Image is the texture that will be used as a stencil.
imageR (imr) float0.0outputinputconnectablestorablekeyable
Image Red channel
imageG (img) float0.0outputinputconnectablestorablekeyable
Image Green channel
imageB (imb) float0.0outputinputconnectablestorablekeyable
Image Blue channel
keyMasking (km) boolfalseoutputinputconnectablestorablekeyable
Key Masking is a switch to enable or disable Chroma Key masking. When this is turned OFF, all other key attributes have no effect.
mask (m) float0.0outputinputconnectablestorablekeyable
Mask is the transparency of the Stencil texture. You can use the Mask attribute either to control the overall transparency of the entire texture, or to control the transparency of select regions of the texture (by mapping another texture to Mask).

For example, if the Stencil texture is mapped to a shader's color, and the Mask value is 0.5, the resulting surface will be an even mix of the shader color and the Stencil texture color. If Mask is mapped with an image of a black circle on white, the Stencil texture color will appear inside the circle, and the shader color will appear outside the circle.

positiveKey (pk) boolfalseoutputinputconnectablestorablekeyable
Positive Key inverts the chroma key mask (only the colors specified in the Color Key and HSV Range are displayed). The default setting is OFF (the colors specified in the Color Key and HSV Range are masked).
saturationRange (sr) float0.5outputinputconnectablestorablekeyable
Saturation Range controls The range of saturations (S) centered on the Color Key color which will also be masked. The valid range is 0 to 1. The default value is 0.5.
threshold (th) float0.5outputinputconnectablestorablekeyable
Threshold controls the point at which the color state changes.
valueRange (vr) float0.5outputinputconnectablestorablekeyable
Value Range controls The range of values (V) centered on the Color Key color which will also be masked. The valid range is 0 to 1. The default value is 0.5.