Go to: Related nodes. Attributes.

The Shading Map shader allows you to create various non-photorealistic shading effects. For example, you can use it to create cartoon-style materials. Use a Shading map shader in conjunction with a regular shader (such as a Phong or Blinn shader) and a texture (such as a Ramp or File texture). It works like a post process --- first, the regular shader computes a color for each point on the surface. Then, the shading maps shader replaces this color with another color. This mapping is based on two things; the brightness of the original color, and the hue of the original color.

For example, you can create a material that renders the bright areas of an object (the areas facing light) as red, and the dark areas of an object (facing away from light) as blue. To do this, use a Shading Map shader, a Lambert shader, and a Ramp texture. The Ramp texture is red on the top, and blue on the bottom. Connect the Lambert shader's Out Color attribute to the Shading Map shader's Color attribute. Connect the Ramp texture's Out Color attribute to the Shading Map shader's Shading Map Color attribute.

When you render, the Lambert shader calculates the color for each point on the material. Then the Shading Map shader replaces the color at each point by 'looking up' a color at on the Ramp texture. The hue of the original color gives the horizontal position on the ramp, and the brightness of the original color gives the vertical position. The original color is replaced with the color at that position on the Ramp. So in this example, the bright areas become red, and the dark areas become blue.

For a different example, let's say you used the same Ramp texture turned sideways. Then no matter how bright the pixel was, it would be mapped to the same color intensity. Colors of different hues would be mapped to different shades of red or blue.

Using similar techniques, Shading Map shaders can be used to do cartoon-style rendering.

In the table below, important attribute have their names indicated in bold in the description column.

This node is MP safe

Node nameParentsClassificationMFn typeCompatible function sets
shadingMapshadingDependNodeshader/surface:drawdb/shader/surface/shadingMapkShadingMapkBase
kNamedObject
kDependencyNode
kShadingMap

Related nodes

lambert, reflect, phongE, phong, blinn, anisotropic, volumeShader, simpleVolumeShader, surfaceShader, displacementShader, layeredShader, useBackground, defaultShaderList

Attributes (40)

color, colorB, colorG, colorR, glowColor, glowColorB, glowColorG, glowColorR, mapFunctionU, mapFunctionV, matteOpacity, matteOpacityMode, outColor, outColorB, outColorG, outColorR, outGlowColor, outGlowColorB, outGlowColorG, outGlowColorR, outMatteOpacity, outMatteOpacityB, outMatteOpacityG, outMatteOpacityR, outTransparency, outTransparencyB, outTransparencyG, outTransparencyR, renderPassMode, shadingMapColor, shadingMapColorB, shadingMapColorG, shadingMapColorR, transparency, transparencyB, transparencyG, transparencyR, uCoord, uvCoord, vCoord

Long name (short name)TypeDefaultFlags
uvCoord (uv) float20.0, 0.0outputinputconnectablehidden
The UV coords of the current sample point
uCoord (uu) float0.0outputinputconnectablehidden
The u component of the current sample position
vCoord (vv) float0.0outputinputconnectablehidden
The v component of the current sample position
mapFunctionU (mfu) enum0outputinputconnectablestorable
Specifies how the input color will be used when looking up in the U direction of shadingMapColor. For example, if set to "value"; the input RGB will be converted to the HSV color space, and brightness will be used as the uCoord when sampling the shading map. A black input color will result in a color lookup from the left side of the shading map, and a white input color will correspond to a lookup from the right side of the shading map.
mapFunctionV (mfv) enum2outputinputconnectablestorable
Specifies how the input color will be used when looking up in the V direction of shadingMapColor. For example, if set to "value"; the input RGB will be converted to the HSV color space, and brightness will be used as the uCoord when sampling the shading map. A black input color will result in a color lookup from the bottom side of the shading map, and a white input color will correspond to a lookup from the top side of the shading map.
color (c) float3outputinputconnectablestorable
Color gives you the base color of the surface. Connect the Out Color attribute of another shader (such as Phong or Blinn) to this attribute. This will give you the initial color, to which the shading map will be applied.

In the Attribute Editor, this is combined with Glow Color and Transparency into a single attribute called Shader

colorR (cr) float0.5outputinputconnectablestorablekeyable
color red value
colorG (cg) float0.5outputinputconnectablestorablekeyable
color green value
colorB (cb) float0.5outputinputconnectablestorablekeyable
color blue value
shadingMapColor (sc) float3outputinputconnectablestorable
Shading Map Color. Connect the Out Color attribute of a texture to this attribute. This can be a ramp, file, or any other kind of texture.

Note: If you do no map this attribute, then the entire surface will appear to be exactly this color, with no shading.

shadingMapColorR (scr) float0.5outputinputconnectablestorablekeyable
shading map color red value
shadingMapColorG (scg) float0.5outputinputconnectablestorablekeyable
shading map color green value
shadingMapColorB (scb) float0.5outputinputconnectablestorablekeyable
shading map color blue value
glowColor (g) float3outputinputconnectablestorable
Glow Color. Connect the Out Glow Color attribute of the input shader to this attribute.

In the Attribute Editor, this is combined with Color and Transparency into a single attribute called Shader

glowColorR (gr) float0.0outputinputconnectablestorablekeyable
glow color red value
glowColorG (gg) float0.0outputinputconnectablestorablekeyable
glow color green value
glowColorB (gb) float0.0outputinputconnectablestorablekeyable
glow color blue value
transparency (it) float3outputinputconnectablestorable
Transparency. Connect the Out Transparency attribute of the input shader to this attribute.

In the Attribute Editor, this is combined with Color and Glow Color into a single attribute called Shader

transparencyR (itr) float0.0outputinputconnectablestorablekeyable
Transparency red value
transparencyG (itg) float0.0outputinputconnectablestorablekeyable
Transparency green value
transparencyB (itb) float0.0outputinputconnectablestorablekeyable
Transparency blue value
outColor (oc) float3outputconnectable
output color
outColorR (ocr) float0.0outputconnectable
outColor red value
outColorG (ocg) float0.0outputconnectable
outColor green value
outColorB (ocb) float0.0outputconnectable
outColor blue value
outTransparency (ot) float3outputconnectable
output Transparency
outTransparencyR (otr) float0.0outputconnectable
outTransparency red value
outTransparencyG (otg) float0.0outputconnectable
outTransparency green value
outTransparencyB (otb) float0.0outputconnectable
outTransparency blue value
outGlowColor (ogc) float3outputconnectable
output color
outGlowColorR (ogr) float0.0outputconnectable
outColor red value
outGlowColorG (ogg) float0.0outputconnectable
outColor green value
outGlowColorB (ogb) float0.0outputconnectable
outColor blue value
matteOpacityMode (mom) enum2outputinputconnectablestorable
Matte Opacity Mode controls how the system will use the Matte Opacity attribute (below). When you are rendering with a matte (i.e. an alpha channel, or mask), these two attributes are used to control how this material will show up in the matte. This is useful if you will be compositing your rendered images later on.

There are three settings, used for different purposes:

    Opacity Gain: (the default). Matte values are calculated in the normal way (based on the transparency of the object) then multiplied by the Matte Opacity. (Matte Opacity has a default value of one, by default these attributes have no effect.) With Opacity Gain, you can animate the Matte Opacity value to change the overall transparency of the object when it is later composited.

    Solid Matte: This is like Opacity Gain, except that the normally-calculated matte values are ignored in favor of the Matte Opacity setting. The entire matte for the object is set to the value of the Matte Opacity attribute. If there are transparent areas on the object, their transparency is ignored in the matte. Use this setting to composite an object with transparent parts, when you don't want the background to show through them.

    Black Hole: The value of Matte Opacity is ignored, and all the matte for this material is set to be transparent. Use this when you are creating substitute geometry in a scene, which is standing in for objects in a background image that you will be compositing with later. Your stand-in objects will 'punch a hole' in the matte. This allows other computer-generated geometry to pass behind your stand-in objects. Later, when foreground and background are composited, the results will be correct, with the background object showing through the 'black hole' areas.

matteOpacity (mog) float1.0outputinputconnectablestorablekeyable
Matte Opacity is used (along with Matte Opactiy Mode) to affect how the matte (i.e. alpha channel or mask) for this material will be calculated. See Matte Opacity Mode above for full details.
outMatteOpacity (omo) float3outputconnectable
output Matte Opacity
outMatteOpacityR (omor) float0.0outputconnectable
output Matte Opacity red value
outMatteOpacityG (omog) float0.0outputconnectable
output Matte Opacity green value
outMatteOpacityB (omob) float0.0outputconnectable
output Matte Opacity blue value
renderPassMode (arp) enum1outputinputconnectablestorablekeyable
renderPassMode controls how the node affects material render passes.