Go to: Related nodes. Attributes.

Single Shading Switch is a utility node that enables you to switch between different values based on which surface is being shaded.

For example, say you have a complex shading network that is being used by many objects. However, two of these objects need to have different Diffusion value.

You could accomplish this by copying the entire shading network for each of these objects. But if you do that, any changes made to the shading network later will have to be repeated for each of the copies.

Instead of copying the network, just use one network with a Single Shading Switch node. Connect the Output attribute of the Single Shading Switch to the Diffusion attribute of the shader. Set the Default attribute of the Single Shading Switch to the value used by most shapes. Then, for each object that needs a different value, specify the object and its particular value.

Now, you can assign the same shader to all the objects, and the objects that need the different diffusion values will get them automatically.

Note: The Single Shading Switch only works on single-valued attributes. If you need to switch double attributes, such as UV coordinates, use a Double Shading Switch. If you need to switch triple attributes, such as 3d coordinates, or colors, use a Triple Shading switch.

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
singleShadingSwitchbaseShadingSwitchutility/switch:drawdb/shader/operation/singleShadingSwitchkSingleShadingSwitchkBase
kNamedObject
kDependencyNode
kSingleShadingSwitch

Related nodes

blendColors, clamp, lightInfo, gammaCorrect, surfaceLuminance, contrast, luminance, rgbToHsv, hsvToRgb, samplerInfo, setRange, resolution, renderQuality, renderGlobals, renderGlobalsList, baseShadingSwitch, doubleShadingSwitch, tripleShadingSwitch

Attributes (5)

default, inShape, inSingle, input, output

Long name (short name)TypeDefaultFlags
input (i) compoundn/aarrayoutputinputconnectablestorable
Input is a combination of two attributes, a value and the name of a shape. This is also a multiple attribute, so you can specify any number of these value/shape pairs.

During rendering, the Output attribute is set depending on which object is being rendered. When one of the objects in in this list are being rendered, then Output is set to its corresponding value. When none of the objects in this list is being rendered, Output is set to equal Default.

inSingle (it) float0.0outputinputconnectablestorablekeyable
InSingle is the "Value" component of Input (see above).
inShape (is) Messagen/aoutputinputconnectable
inShape in the "Shape" component of Input (see above).
default (def) float0.0outputinputconnectablestorablekeyable
Default is the value used by this node when it is not rendering one of the nodes on the Input list..
output (out) float0.0outputconnectable
Output is the Output value of the switch. This value depends on what shape is being rendered. When one of the objects in the Input list is being rendered, then Output is set to its corresponding value. When none of the objects in the list is being rendered, Output is set to equal Default.