# 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 Maya gets automatically translated to and from Simplygon materials during export and import, but there are some cases where user input is required. DirectX, CGFX and Stingray materials with custom (HLSL) shaders do not follow any template / naming schema that we can use to automatically map material properties, for these material types shading network templates have to be setup manually.
# Fundamentals
A material in Simplygon can have several material channels, for example ambientColor, color, specularColor and normalCamera which can be found in standard materials in Maya, 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
Maya Name | API Name | No of Inputs | Description |
---|---|---|---|
TextureNode | spShadingTextureNode | 0 | Points at a texture |
ColorNode | spShadingColorNode | 1 | RGBA color |
AddNode | spShadingAddNode | 2 | Adds two input nodes together |
SubtractNode | spShadingSubtractNode | 2 | Subtracts input 1 from input 0 |
MultiplyNode | spShadingMultiplyNode | 2 | Multiplies input 1 with input 0 |
DivideNode | spShadingDivideNode | 2 | Divides input 0 with input 1 |
InterpolateNode | spShadingInterpolateNode | 3 | Interpolates input 0 and 1 based on 2 |
ClampNode | spShadingClampNode | 3 | Clamps input 0 based on 1 and 2 |
SwizzlingNode | spShadingSwizzlingNode | 4 | Swizzles the channels |
VertexColorNode | spShadingVertexColorNode | 0 | Points at a vertex color set |
LayeredBlendNode | spShadingLayeredBlendNode (internal) | unlimited | Blends textures together from start to end, based on blend mode |
PowNode | spShadingPowNode | 2 | The power (input 1) of input 0 |
StepNode | spShadingStepNode | 2 | Steps up/down the values from input 0 based on input 1 |
Normalize3Node | spShadingNormalize3Node | 1 | Normalizes input 0 |
SqrtNode | spShadingSqrtNode | 1 | Sqrt of input 0 |
Dot3Node | spShadingDot3Node | 2 | Dot of input 0 and input 1 |
Cross3Node | spShadingCross3Node | 2 | Cross of input 0 and input 1 |
CosNode | spShadingCosNode | 1 | Cos of input 0 |
SinNode | spShadingSinNode | 1 | Sin of input 0 |
MaxNode | spShadingMaxNode | 2 | Max of input 0 and input 1 |
MinNode | spShadingMinNode | 2 | Min of input 0 and input 1 |
EqualNode | spShadingEqualNode | 2 | 1.0f if value in input 0 equals the value in input 1, otherwise 0.0f |
NotEqualNode | spShadingNotEqualNode | 2 | 1.0f if value in input 0 does not equal the value in input 1, otherwise 0.0f |
GreaterThanNode | spShadingGreaterThanNode | 2 | 1.0f if value in input 0 is greater than the value in input 1, otherwise 0.0f |
LessThanNode | 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: