Shading
The Shading section defines the base shading of the material. It controls how the material reflects light in a diffuse way, and how it is affected by other lighting. Options in the Light Data section heavily affect how shading is performed.
Various Shading Styles applied on these multiple Material Spheres.
This section often uses some terms interchangeably.
- Lighting and Shading are both talking about how the material is affected by light.
- Ramp and Gradient are both terms for a 1-dimensional function, using one input and producing one output.
Lighting Type
Type
: Dropdown, Options:TextureRamp
/Multilayer Math
/Wrapped
/Skin
/ShadeMap
/Flat
/Realistic
/Cloth
Lighting mode to use. Each of these models uses the same lighting data in different ways to produce different lighting effects.
This option cannot be animated at runtime - consider a material swap if you need to change the lighting mode for some reason!
TextureRamp
TextureRamp is a Toon lighting method that uses a gradient texture to determine the lighting level. This texture can be edited using the Thry gradient editor by clicking the gradient slot.
Texture Ramp lighting is useful for creating cartoon-like lighting, especially when specific color gradients are desired.
Demonstration of Texture Ramp Shading using Thry Gradient Editor.
TextureRamp Options
Shadow Tint
Type
: Color
Shadow Tint will tint the shadow map with a specific color, useful for creating a specific stylized shading effect. This color will be mixed with the Lighting Ramp and Ambient Color (if enabled) to produce the final shading.
Lighting Ramp
Type
: Color Gradient Texture (sRGB ON)
Ramp texture that controls the lighting. The lightmap is mapped from left-to-right, with the left-most pixel being the darkest, and the right-most pixel being the lightest. This texture generally uses a black-to-white gradient, but it can contain colors to create a more specific lighting effect.
This texture can be edited using the Thry gradient editor by clicking the gradient slot.
Ramp Offset
Type
: Float, Range:-1.0 - 1.0
Offsets the ramp from left to right. Negative values will bias the lighting toward the left (darker) side, and positive values will bias the lighting toward the right (lighter) side.
Shadow Strength
Type
: Float, Range:0.0 - 1.0
Determines how strong of a shadow is applied. A value of 0.0
will not apply any shadow, and a value of 1.0
will apply a full shadow.
Ignore Indirect Shadow Color
Type
: Float, Range:0.0 - 1.0
Determines whether or not to incorporate the full ambient color into the lighting calculation. A value of 0.0
will ignore the ambient color, and a value of 1.0
will fully tint the shadow with the ambient color.
Multilayer Math
Multilayer Math is a Toon Lighting method that uses mathematically defined gradients to determine the lighting level. These gradients can be edited using the defined settings, and set using colors or textures. Multilayer Math is similar to the lighting model used in the LilToon shader. Multilayer Math shading is useful for creating robust shading that performs well in most lighting conditions.
On a basic level, Multilayer Math has three shadow layers, and a border. Not all layers need to be used, nor the border. In previous versions of the shader, the Math Gradient shading mode was used to create a similar effect, but this mode was removed in favor of the more flexible Multilayer Math.
Demonstration of Multilayer Math Shading with the Shadow Layers.
Multilayer Math Options
Shadow Layers
Shadow Layer 1 Options
Color Tex
Type
: Color Texture (sRGB = ON
)
The Shadow Color texture, if defined, sets the base color of the shadow in different parts of the model. Will be tinted by the Shadow color.
Color
Type
: Color
Defines the basic shadow color for the Multilayer Math shading model. This color must have a non-zero alpha value to take effect.
Border
Type
: Float, Range:0.0 - 1.0
Defines the position on the lightmap of the border between the shadow color and light. In other words, this sets where the edge of the shadow is.
Blur
Type
: Float, Range:0.0 - 1.0
Defines how much to blur the shadow out from the border position. A value of 0.0
will not blur the shadow, and a value of 1.0
will blur the shadow to the edge of the lightmap.
Receive Shadow
Type
: Float, Range:0.0 - 1.0
How much this shadow layer should receive shadows.
Shadow Layer 2 Options
Color Tex
Type
: Color Texture (sRGB = ON
)
The Shadow Color texture, if defined, sets the base color of the shadow in different parts of the model. Will be tinted by the Shadow color.
Color
Type
: Color
Defines the basic shadow color for the Multilayer Math shading model. This color must have a non-zero alpha value to take effect.
Border
Type
: Float, Range:0.0 - 1.0
Defines the position on the lightmap of the border between the shadow color and light. In other words, this sets where the edge of the shadow is.
Blur
Type
: Float, Range:0.0 - 1.0
Defines how much to blur the shadow out from the border position. A value of 0.0
will not blur the shadow, and a value of 1.0
will blur the shadow to the edge of the lightmap.
Receive Shadow
Type
: Float, Range:0.0 - 1.0
How much this shadow layer should receive shadows.
Shadow Layer 3 Options
Color Tex
Type
: Color Texture (sRGB = ON
)
The Shadow Color texture, if defined, sets the base color of the shadow in different parts of the model. Will be tinted by the Shadow color.
Color
Type
: Color
Defines the basic shadow color for the Multilayer Math shading model. This color must have a non-zero alpha value to take effect.
Border
Type
: Float, Range:0.0 - 1.0
Defines the position on the lightmap of the border between the shadow color and light. In other words, this sets where the edge of the shadow is.
Blur
Type
: Float, Range:0.0 - 1.0
Defines how much to blur the shadow out from the border position. A value of 0.0
will not blur the shadow, and a value of 1.0
will blur the shadow to the edge of the lightmap.
Receive Shadow
Type
: Float, Range:0.0 - 1.0
How much this shadow layer should receive shadows.
Border
Border Options
Border Color
Type
: Color
The Border Color defines the color of a border, which is an extra color applied to the edge of the main shadow. This color must have a non-zero alpha value to take effect.
Border Range
Type
: Float, Range:0.0 - 1.0
How far off of the border the border color is applied. A value of 0.0
will apply the border color to the edge of the shadow, and a value of 1.0
will apply the border color to the dark edge of the lightmap.
Shadow Border Map
Type
: Checkbox
Enables the Shadow Border Map feature, allowing control over AO-style shadow boundaries on Multilayer Math.
Shadow Border Map Options
Shadow Border Map
Type
: Data Texture (sRGB = OFF
)
Post AO
Type
: Checkbox
Enables Post Ambient-Occlusion on the Shadow Border Map.
Border Map LOD
Type
: Float, Range:0.0 - 1.0
Amount of Level of Detail to use for the Border Map.
1st Min
Type
: Float, Range:0.0 - 1.0
Minimum amount from the Shadow Border to apply to Layer 1.
1st Max
Type
: Float, Range:0.0 - 1.0
Maximum amount from the Shadow Border to apply to Layer 1.
2nd Min
Type
: Float, Range:0.0 - 1.0
Minimum amount from the Shadow Border to apply to Layer 2.
2nd Max
Type
: Float, Range:0.0 - 1.0
Maximum amount from the Shadow Border to apply to Layer 2.
3rd Min
Type
: Float, Range:0.0 - 1.0
Minimum amount from the Shadow Border to apply to Layer 3.
3rd Max
Type
: Float, Range:0.0 - 1.0
Maximum amount from the Shadow Border to apply to Layer 3.
Non Linear Lightmap
Type
: Checkbox
If enabled, changes the shadow gradient direction to be non-linear.
Base Color Blend
Type
: Float, Range:0.0 - 1.0
How much to blend the shadow gradients to the Base Color.
Shadow Strength
Type
: Float, Range:0.0 - 1.0
Determines how strong of a shadow is applied. A value of 0.0
will not apply any shadow, and a value of 1.0
will apply a full shadow.
Ignore Indirect Shadow Color
Type
: Float, Range:0.0 - 1.0
Determines whether or not to incorporate the full ambient color into the lighting calculation. A value of 0.0
will ignore the ambient color, and a value of 1.0
will fully tint the shadow with the ambient color.
Wrapped
Wrapped lighting is a semi-realistic lighting method that uses a mathematical gradient to determine the lighting level, like Multilayer Math. However, it wraps the gradient around the edges of the material. This creates a softer, more realistic lighting effect. Wrapped lighting is useful for creating flexible, realistic lighting that performs well in most lighting conditions.
For technical details of this method, see Jordan Stevens' Lighting Models In Unity (Half-Lambert (Diffuse Wrap) section), Stephen Hill's Righting Wrap, or Steve McAuley's Energy-Conserving Wrapped Diffuse.
Demonstration of Wrapped Shading and the various adjustments.
Wrapped Options
Shadow Tint
Type
: Color
Shadow Tint will tint the shadow map with a specific color, useful for creating a specific stylized shading effect. This color will be mixed with the Ambient Color (if enabled) to produce the final shading.
LightSide Color
Type
: Color
LightSide Color will tint the color of the side in Lighting.
Wrap
Type
: Float, Range:0.0 - 2.0
Determines how much to wrap the gradient around the edges of the model. A value of 0.0
will not wrap the gradient at all, producing a realistic, more aggressive shadow edge. Increase this value to wrap the gradient more significantly, producing a softer, more stylized shadow edge. At a value of 2.0
the gradient will produce an almost flat lit effect.
Normalization
Type
: Float, Range:0.0 - 1.0
Normalization is a value that determines how much to darken the wrapped gradient. This is usually kept at 0.5
, but can be adjusted (especially on the fly) to dynamically adjust the model's light level.
How much this value applies depends on the Wrap value. At a Wrap of 0.0
, Normalization will have no effect at all. At increasing Wrap values, Normalization will have an increasingly important effect.
Gradient Start
Type
: Float, Range:0.0 - 1.0
Gradient Start controls the start point of the lightmap gradient that the wrap is applied to. Generally, this value is kept between 0.0 - 0.2
, with higher values resulting in more bright areas on the model.
Gradient End
Type
: Float, Range:0.0 - 1.0
Gradient End controls the end point of the lightmap gradient that the wrap is applied to. Generally, this value is kept between 0.5 - 1.0
, with higher values resulting in less dark areas on the model. A wider range between the Gradient Start and Gradient End will result in a softer gradient, while a narrower range will result in a sharper gradient.
Shadow Strength
Type
: Float, Range:0.0 - 1.0
Determines how strong of a shadow is applied. A value of 0.0
will not apply any shadow, and a value of 1.0
will apply a full shadow.
Ignore Indirect Shadow Color
Type
: Float, Range:0.0 - 1.0
Determines whether or not to incorporate the full ambient color into the lighting calculation. A value of 0.0
will ignore the ambient color, and a value of 1.0
will fully tint the shadow with the ambient color.
Skin
Skin lighting is a semi-realistic lighting method that uses a Lookup table (LUT) to determine the lighting level. An example LUT (SkinLUT.png
) is included in the shader package. The details of this method are more technical, but using skin lighting is simple.
Skin lighting is useful for achieving a realistic human skin lighting effect.
This lighting mode is experimental and is not fully implemented yet, as it requires more data (thickness maps) to work fully. This will be improved in the future.
Demonstration of Skin Shading and how a Thickness Map is used with it.
Skin Options
Shadow Tint
Type
: Float, Range:0.0 - 1.0
Shadow Tint will tint the shadow with a specific color, useful for creating a specific stylized shading effect. This color will be mixed with the Ambient Color (if enabled) to produce the final shading.
LUT
Type
: Data Texture (sRGB OFF)
The LUT is used to determine the lighting ramp at various scales. This texture consists of a series of RGB values, with the horizontal axis representing the light level, and the vertical axis representing the thickness of the skin.
Scale
Type
: Float, Range:0.0 - 1.0
Scales the Subsurface Scattering (SSS) effect. A value of 0.0
will disable the SSS effect, and a value of 1.0
will apply the SSS effect at full strength.
Thickness Map
Type
: Data Texture (sRGB OFF)
Thickness Power
Type
: Float, Range:0.0 - 3.0
Modifies the amount of influence the Thickness Map has on the LUT.
Bump Blur
Type
: Float, Range:0.0 - 1.0
Sets how much to blur the Bumps from the Thickness Map.
Shadow Strength
Type
: Float, Range:0.0 - 1.0
Determines how strong of a shadow is applied. A value of 0.0
will not apply any shadow, and a value of 1.0
will apply a full shadow.
Ignore Indirect Shadow Color
Type
: Float, Range:0.0 - 1.0
Determines whether or not to incorporate the full ambient color into the lighting calculation. A value of 0.0
will ignore the ambient color, and a value of 1.0
will fully tint the shadow with the ambient color.
ShadeMap
ShadeMap lighting uses textures to determine the lighting level. Options are available for using specific ShadeMap images, or to use the base color map as the ShadeMap, with a specific ShadeColor tint added.
ShadeMap lighting is useful for creating highly stylized lighting effects. It's similar to UnityChan Toon Shader 2's three-color shading system.
For a basic ShadeMap shading setup, you can enable Use BaseMap as 1st ShadeMap and Use BaseMap as 2nd ShadeMap, set the 1st ShadeColor and 2nd ShadeColor to a lighter and darker tone respectively, and set the BaseColor Step and ShadeColor Step to a larger (0.4 - 0.6
) and smaller (0.1 - 0.3
), respectively.
Demonstration of ShadeMap and it's properties.
ShadeMap Options
1st ShadeColor
Type
: Color
Primary tint applied to the 1st ShadeMap. If ShadeMap texture is defined, this color will be mixed with the ShadeMap texture. If not, it should generally be set lighter than the 2nd ShadeColor.
1st ShadeMap
Type
: Color Texture (sRGB ON)
Shading map used for the 1st ShadeColor. If this is not defined, the 1st ShadeColor alone will be used. Shading maps define what the shadow should look like in this area.
Use BaseMap as 1st ShadeMap
Type
: Checkbox
Whether to use the BaseColor map as the 1st ShadeMap. With no 1st ShadeMap defined, this should generally be enabled.
2nd ShadeColor
Type
: Color
Primary tint applied to the 1st ShadeMap. If ShadeMap texture is defined, this color will be mixed with the ShadeMap texture. If not, it should generally be set lighter than the 2nd ShadeColor.
2nd ShadeMap
Type
: Color Texture (sRGB ON)
Shading map used for the 1st ShadeColor. If this is not defined, the 1st ShadeColor alone will be used.
Use BaseMap as 2nd ShadeMap
Type
: Checkbox
Whether to use the BaseColor map as the 2nd ShadeMap. With no 2nd ShadeMap defined, this should generally be enabled.
BaseColor_Step
Type
: Float, Range:0.01 - 1.0
Defines where the edge should lie between the base lit color and the 1st shadow. A value of 0.0
will result in a completely lit area, and a value of 1.0
will result in a completely shadowed area.
Base/Shade_Feather
Type
: Float, Range:0.0001 - 1.0
How much to feather the edge of the base color and shading. A value of 0.0
will result in a sharp edge, and a value of 1.0
will result in a very smooth edge.
ShadeColor_Step
Type
: Float, Range:0.01 - 1.0
Defines where the edge should lie between the 1st shadow and the 2nd shadow. A value of 0.0
will result in no 2nd shadow, and a value of 1.0
will make the 2nd shadow dominate the overall shadow. This value is dependent on the BaseColor_Step value.
1st/2nd_Shades_Feather
Type
: Float, Range:0.0001 - 1.0
How much to feather the edge of the 1st shadow and the 2nd shadow. A value of 0.0
will result in a sharp edge, and a value of 1.0
will result in a very smooth edge.
Blend Mode
Type
: Dropdown, Options:Replace
/Multiply
Defines how the shadow should blend with the base color. Replace will replace the base color with the shadow, creating a more straightforward effect. Multiply will multiply the base color with the shadow, creating a more stylized effect.
Shadow Strength
Type
: Float, Range:0.0 - 1.0
How much to apply the shadow. A value of 0.0
will not apply any shadow, and a value of 1.0
will apply the shadow fully.
Flat
Flat Lighting is a toon lighting mode that uniformly lights the model at the same level. The direct and indirect lighting data is used to calculate an average across the entire model. It does not incorporate the model normals, or any normal maps, to determine lighting.
Flat Light is useful for creating models that are highly robust to local lighting, but sacrifices detail.
The Flat
lighting mode has no user-configurable options.
Flat Shading. Completely life-less.
Realistic
Realistic lighting is a physically-based lighting model that behaves similar to the lighting found in the Unity Standard shader. It's useful for creating models that are realistic and perform well in many lighting conditions.
Realistic Shading.