Skip to content

Shader Documentation

shadowmage45 edited this page Oct 25, 2018 · 14 revisions

Shader Documentation

Shader Summary

The shaders included in TexturesUnlimited are:

  • TU/Metallic - PBR - Metallic Workflow
  • TU/Specular - PBR - Specular Workflow
  • TU/Legacy - BlinnPhong - Colored Specular
  • TU/Transparent/Metallic - transparent version of above - depth test on, z-write off, standard blending (additive?)
  • TU/Transparent/Specular - transparent version of above - depth test on, z-write off, standard blending (additive?)
  • TU/Transparent/Legacy - transparent version of above - depth test on, z-write off, standard blending (additive?)

Shader Details

All of the TU/ shader share a common set of functionality; their only differences are in the workflow/lighting model used, as described above. Documentation on the workflows may be found in the links below. Some of the texture slot names may differ, but the main inputs and workflow are the same as the Unity Standard shader variants. The exception to this would be the advanced features such as recoloring and subsurface scattering, which will be detailed below.

Metallic -
Specular -
Legacy -

Texture Inputs

_MainTex - RGB - Optional RGBA

Albedo/Diffuse texture. This describes the main color of the object. Alpha channel may contain transparency or smoothness data.

_MetallicGlossMap - RA - Optional R

In Metallic workflow this texture input contains the metallic mask in the [R]ed channel. Smoothness should be in the [A]lpha channel. Unused in Specular and Legacy workflow.

_SpecGlossMap - RGBA - Optional RGB

In Specular and Legacy workflow this texture input contains the specular color in the RGB channels. Smoothness should be in the [A]lpha channel. Unused in Metallic workflow.

_BumpMap - RGB(png) / RGBA(dds)

Standard normal map texture. Always enabled; can be left empty/unused if needed.

_Emission - RGB

Controls material emission amounts, to make a material seem to emit light. Used mostly for cabin-window-lighting effects. Always enabled; may be left empty/unused if needed.

_AOMap - G

Ambient occlusion texture. Sample is taken from the [G]reen channel in the texture, so in the metallic workflow this texture data may optionally be packed into the MetallicGlossMap. Always enabled; may be left empty/unused if needed.

_Thickness - RGB

Colored thickness map used by subsurface scattering effects. Only enabled when subsurface scattering is enabled.

_MaskTex - RGBA

The mask texture is the main input component of the recoloring system; it determines what parts of the model are assigned to each of the three recoloring selections (main, second, detail). Alpha channel may contain luminance normalization data for use in the recoloring system. Details on its setup and use can be found in the section on recoloring below. Only enabled when recoloring is enabled.

_MetalGlossNormMask -RA / _SpecGlossNormMask - RGBA

Used by the recoloring system to normalize metal/smooth or spec/smooth source textures for use in the recoloring system. Details on their setup and use can be found in the section on recoloring below. Only enabled when recoloring normalization is enabled.

_MetalGlossInputMask -RA / _SpecGlossInputMask - RGBA

Used by the recoloring system to remove user control and recoloring input of metallic/specular/smoothness (independently of each other). Details on their setup and use can be found in the section on recoloring below. Only enabled when recoloring input masking is enabled.

Parameter Inputs

_Color - RGB - Optional RGBA

Multiplier to the texture sampled color value for diffuse/albedo coloring. Alpha channel serves as a multiplier to texture sampled alpha value for transparency.

_Metal - Float - Metallic Workflow Only

Multiplier to the texture based metallic value. If no texture is provided, this is the main metallic value control.

_SpecularColor - RGB - Specular/Legacy Workflow Only

Multiplier to the texture based specular color. If no texture is provided, this is the main specular color control.

_Smoothness - Float

Multiplier to the texture based smoothness. If no texture is provided, this is the main smoothness control.

_EmissiveColor - RGBA

Multiplier to the input emission texture. Self-multiplies by the alpha channel; output = RGB * A.

_Opacity - Float

Manual opacity control used by KSP for part highlighting functions - do not manually adjust. Use _Color alpha channel for user specified opacity.

_RimFalloff

Used by KSP for part highlighting functions.

_RimColor

Used by KSP for part highlighting functions.

_TemperatureColor

Used by KSP for temperature/heat based glow effects.

_BurnColor

Used by KSP for ??

_SubSurfAmbient

Subsurface scattering ambient light factor.

_SubSurfScale

Subsurface scattering effect multiplier.

_SubSurfPower

Subsurface scattering exponential/non-linear growth factor.

_SubSurfDistort

Subsurface scattering surface-normal distortion contribution factor.

_SubSurfAtten

Subsurface scattering thickness-texture driven light attenuation factor.

_MaskColor1 - RGBA

  • RGB = Diffuse/Albedo for Channel 1 (Main)
  • A = Smoothness for Channel 1 (Main)

_MaskColor2 - RGBA

  • RGB = Diffuse/Albedo for Channel 2 (Second)
  • A = Smoothness for Channel 2 (Second)

_MaskColor3 - RGBA

  • RGB = Diffuse/Albedo for Channel 3 (Detail)
  • A = Smoothness for Channel 3 (Detail)

_MaskMetallic - RGB

  • R = Metal value for Channel 1 (Main)
  • G = Metal value for Channel 2 (Second)
  • B = Metal value for Channel 3 (Detail)

_DiffuseNorm - RGB

  • R = Diffuse Normalization - For Channel 1 (Main)
  • G = Diffuse Normalization - For Channel 2 (Second)
  • B = Diffuse Normalization - For Channel 3 (Detail)

_MetalNorm - RGB (Metallic workflow only)

  • R = Metal Normalization - For Channel 1 (Main)
  • G = Metal Normalization - For Channel 2 (Second)
  • B = Metal Normalization - For Channel 3 (Detail)

_SpecularNorm - RGB (Specular workflow only)

  • R = Specular Color Luminance Normalization - For Channel 1 (Main)
  • G = Specular Color Luminance Normalization - For Channel 2 (Second)
  • B = Specular Color Luminance Normalization - For Channel 3 (Detail)

_SmoothnessNorm - RGB (Specular workflow only)

  • R = Smoothness Normalization - For Channel 1 (Main)
  • G = Smoothness Normalization - For Channel 2 (Second)
  • B = Smoothness Normalization - For Channel 3 (Detail)

Keyword activated features

TU_SUBSURF_OFF (default) / TU_SUBSURF

TU_RECOLORING_OFF (default) / TU_RECOLORING_STANDARD

TU_STD_SPEC (default) / TU_STOCK_SPEC

Controls if smoothness data is sampled from spec/metal alpha channel (TU_STD_SPEC), or from diffuse alpha channel (TU_STOCK_SPEC).

TU_RECOLOR_NORM_OFF (default) / TU_RECOLOR_NORM / TU_RECOLOR_INPUT / TU_RECOLOR_NORM_INPUT

Clone this wiki locally