# Simplygon Shading Networks

# What is a shading network ?

Shading networks are a fundamental part of Simplygon's material pipeline and are used to describe Simplygon materials in a hierarchial node-based manner. Most shading nodes supported by the Simplygon API are supported by the plug-in and the input for the nodes matches the ones in the API.

Most standard materials in Max gets automatically translated to and from Simplygon materials during export and import, but there are some cases where user input is required. DirectX materials with custom (HLSL) shaders do not follow any template / naming schema that we can use to automatically map the material properties, for these materials shading networks have to be setup manually.

# Fundamentals

A material in Simplygon can have several material channels, for example Ambient_Color, Diffuse_Color, Specular_Color and Bump which can be found in standard materials in Max, or Ambient, Diffuse, Specular and Normals which will be used in HLSL examples later on. There are also possibility to add custom channels, if needed. Each of these material channels has its own shading network which is Simplygon’s way of describing a material.

Shading networks are responsible for the visual representation of a material, as well as a description of what will be baked during processing. A shading network starts with one node, an exit node which can be of any (shading) node type, for example a texture-, add- or multiply node.

# Supported shading nodes

Max Name API Name No of Inputs Description
ShadingTextureNode spShadingTextureNode 0 Points at a texture
ShadingColorNode spShadingColorNode 1 RGBA color
ShadingAddNode spShadingAddNode 2 Adds two input nodes together
ShadingSubtractNode spShadingSubtractNode 2 Subtracts input 1 from input 0
ShadingMultiplyNode spShadingMuliplyNode 2 Multiplies input 1 with input 0
ShadingDivideNode spShadingDivideNode 2 Divides input 0 with input 1
ShadingInterpolateNode spShadingInterpolateNode 3 Interpolates input 0 and 1 based on 2
ShadingClampNode spShadingClampNode 3 Clamps input 0 based on 1 and 2
ShadingSwizzlingNode spShadingSwizzlingNode 4 Swizzles the channels
ShadingVertexColorNode spShadingVertexColorNode 0 Points at a vertex color set
ShadingLayeredBlendNode spShadingLayeredBlendNode (internal) unlimited Blends textures together from start to end, based on blend mode
ShadingPowNode spShadingPowNode 2 The power (input 1) of input 0
ShadingStepNode spShadingStepNode 2 Steps up/down the values from input 0 based on input 1
ShadingNormalize3Node spShadingNormalize3Node 1 Normalizes input 0
ShadingSqrtNode spShadingSqrtNode 1 Sqrt of input 0
ShadingDot3Node spShadingDot3Node 2 Dot of input 0 and input 1
ShadingCross3Node spShadingCross3Node 2 Cross of input 0 and input 1
ShadingCosNode spShadingCosNode 1 Cos of input 0
ShadingSinNode spShadingSinNode 1 Sin of input 0
ShadingMaxNode spShadingMaxNode 2 Max of input 0 and input 1
ShadingMinNode spShadingMinNode 2 Min of input 0 and input 1
ShadingEqualNode spShadingEqualNode 2 1.0f if value in input 0 equals the value in input 1, otherwise 0.0f
ShadingNotEqualNode spShadingNotEqualNode 2 1.0f if value in input 0 does not equal the value in input 1, otherwise 0.0f
ShadingGreaterThanNode spShadingGreaterThanNode 2 1.0f if value in input 0 is greater than the value in input 1, otherwise 0.0f
ShadingLessThanNode spShadingLessThanNode 2 1.0f if value in input 0 is smaller than the value in input 1, otherwise 0.0f

# Next steps

Get to know how to work with Shading Networks: