Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Last active January 2, 2022 04:08
Show Gist options
  • Save cecilemuller/8f090aebfb5897651416b5a4089dcb42 to your computer and use it in GitHub Desktop.
Save cecilemuller/8f090aebfb5897651416b5a4089dcb42 to your computer and use it in GitHub Desktop.
Marmoset Toolbag: Shader subroutine fields

Marmoset Toolbag: Shader subroutine fields

Materials are composed of shader blocks, each block has multiple subroutine variants.

Shader blocks:

Example:

mymat = mset.findMaterial("My Existing Material")
if isinstance(mymat, mset.Material):
	# Set a specific variant for a block:
	mymat.setSubroutine("albedo", "Vertex Color")

	# Disable a shader block:
	mymat.setSubroutine("microsurface", "")

See also:


"albedo" shader

Albedo subroutine fields:

  • Albedo Map: mset.Texture
  • Color: List (float, float, float)

Vertex Color subroutine fields:

  • Albedo Map: mset.Texture
  • Color: List (float, float, float)
  • Vertex Color: bool
  • sRGB Color: bool
  • Vertex Alpha: bool

Dota Color subroutine fields:

  • Color Map: mset.Texture
  • Detail Mask: mset.Texture
  • Channel;detailMask: int (0: R, 1: G, 2: B, 3: A)
  • Diffuse/Fresnel Mask: mset.Texture
  • Channel;diffFresnelMask: int (0: R, 1: G, 2: B, 3: A)
  • Metalness Mask: mset.Texture
  • Channel;metalnessMask: int (0: R, 1: G, 2: B, 3: A)
  • Self-Illumination Mask: mset.Texture
  • Channel;selfIllumMask: int (0: R, 1: G, 2: B, 3: A)
  • Self Illumination: float (0.0 to 8.0)
  • Detail Map: mset.Texture
  • Detail Strength: float (0.0 to 8.0)
  • Detail Tile: float (0.0 to 128.0)
  • Fresnel Warp: mset.Texture
  • Fresnel Color Warp: mset.Texture

"diffusion" shader

Unlit subroutine fields:

Lambertian subroutine fields:

Microfiber subroutine fields:

  • Fuzz Map: mset.Texture
  • Fuzz: float (0.0 to 1.0)
  • Fuzz Color: List (float, float, float)
  • Fuzz Scatter: float (0.0 to 1.0)
  • Fuzz Occlusion: float (0.0 to 1.0)
  • Mask Fuzz with Gloss: bool

Subsurface Scatter subroutine fields:

  • Scatter Map: mset.Texture
  • Scatter Depth (mm): float (0.0 to 1000.0)
  • Scatter Color: List (float, float, float)
  • Translucency Map: mset.Texture
  • Translucency: float (0.0 to 1.0)
  • Translucency Color: List (float, float, float)
  • Translucency Depth (mm): float (0.0 to 1000.0)
  • Translucency Scatter: float (0.0 to 1.0)
  • Fuzz Map: mset.Texture
  • Fuzz: float (0.0 to 1.0)
  • Fuzz Color: List (float, float, float)
  • Mask Fuzz with Gloss: bool

Dota Diffuse subroutine fields:

  • Diffuse Warp: mset.Texture

"displacement" shader

Height subroutine fields:

  • Displacement Map: mset.Texture
  • Scale: float (0.0 to 1.0)
  • Scale Center: float (0.0 to 1.0)
  • Relative Scale: bool

Vector subroutine fields:

  • Displacement Map: mset.Texture
  • Tangent Space: bool
  • Flip X: bool
  • Flip Y: bool
  • Flip Z: bool
  • Scale: float (0.0 to 4.0)
  • Scale Center: float (0.0 to 1.0)
  • Relative Scale: bool

"emissive" shader

Emissive subroutine fields:

  • Emissive Map: mset.Texture
  • Color: List (float, float, float)
  • Intensity: float (0.0 to 10.0)
  • UV Set: int (0 or 1.0)
  • Glow: List (float, float, float)

Heat subroutine fields:

  • Heat Map: mset.Texture
  • Intensity: float (0.0 to 10.0)
  • Temperature (K): float (0.0 to 10000.0)
  • Minimum Temperature (K): float (0.0 to 10000.0)

Fluorescent subroutine fields:

  • Fluorescence Map: mset.Texture
  • Color: List (float, float, float)
  • Strength: float (0.0 to 50.0)

"microsurface" shader

Gloss subroutine fields:

  • Gloss Map: mset.Texture
  • Channel: int (0: R, 1: G, 2: B, 3: A)
  • Gloss: float (0.0 to 1.0)
  • Invert: bool

Roughness subroutine fields:

  • Roughness Map: mset.Texture
  • Channel: int (0: R, 1: G, 2: B, 3: A)
  • Roughness: float (0.0 to 1.0)
  • Invert;roughness: bool

Advanced Micro subroutine fields:

  • Microsurface Map: mset.Texture
  • Channel: int (0: R, 1: G, 2: B, 3: A)
  • Mode: int (0: Smoothness, 1: Roughness)
  • Maximum: float (0.0 to 1.0)
  • Minimum: float (0.0 to 1.0)
  • Exponent: float (0.1 to 8.0)
  • Horizon Smoothing: float (0.0 to 1.0)

"occlusion" shader

Occlusion subroutine fields:

  • Occlusion Map: mset.Texture
  • Channel;occlusion: int (0: R, 1: G, 2: B, 3: A)
  • Occlusion: float (0.0 to 1.0)
  • UV Set: int (0 or 1)
  • Vertex Channel: int (0: -, 1: R, 2: G, 3: B, 4: A)
  • Cavity Map: mset.Texture
  • Channel;cavity: int (0: R, 1: G, 2: B, 3: A)
  • Diffuse Cavity: float (0.0 to 1.0)
  • Specular Cavity: float (0.0 to 1.0)

"reflection" shader

Mirror subroutine fields:

  • Horizon Occlusion: float (0.0 to 4.0)

Blinn-Phong subroutine fields:

  • Horizon Occlusion: float (0.0 to 4.0)

GGX subroutine fields:

  • Horizon Occlusion: float (0.0 to 4.0)

Anisotropic subroutine fields:

  • Horizon Occlusion: float (0.0 to 4.0)
  • Direction Map: mset.Texture
  • Scale & Bias: bool
  • Swap X/Y Direction: bool
  • Anisotropy: float (0.0 to 1.0)
  • Anisotropy Direction: float (0.0 to 360.0)

"reflectivity" shader

Specular subroutine fields:

  • Specular Map: mset.Texture
  • Channel;specular: int (0: R, 1: G, 2: B, 3: A, 4: RGB)
  • Intensity: float (0.0 to 1.0)
  • Color: List (float, float, float)
  • Fresnel: float (0.0 to 1.0)
  • Fresnel Color: List (float, float, float)
  • Conserve Energy: bool

Metalness subroutine fields:

  • Metalness Map: mset.Texture
  • Channel: int (0: R, 1: G, 2: B, 3: A)
  • Metalness: float (0.0 to 1.0)
  • Invert: bool

Adv. Metalness subroutine fields:

  • Metalness Map: mset.Texture
  • Channel: int (0: R, 1: G, 2: B, 3: A)
  • Metalness: float (0.0 to 1.0)
  • Invert: bool
  • Specular Level Map: mset.Texture
  • Channel;advMtlMask: int (0: R, 1: G, 2: B, 3: A)
  • Specular: float (0.0 to 0.16)
  • Invert: bool
  • Specular Curve: bool

Refractive Index subroutine fields:

  • Index Map: mset.Texture
  • Index: float (1.0 to 5.0)
  • Index Hue: List (float, float, float)
  • Extinction: float (0.0 to 10.0)
  • Extinction Hue: List (float, float, float)

Dota Specular subroutine fields:

  • Specular Mask: mset.Texture
  • Channel;specMask: int (0: R, 1: G, 2: B, 3: A)
  • Rimlight Mask: mset.Texture
  • Channel;rimMask: int (0: R, 1: G, 2: B, 3: A)
  • Tint Mask: mset.Texture
  • Channel;tintMask: int (0: R, 1: G, 2: B, 3: A)
  • Specular Exponent;map: mset.Texture
  • Channel;expMask: int (0: R, 1: G, 2: B, 3: A)
  • Specular Exponent: float (1.0 to 512.0)
  • Specular Scale: float (0.0 to 30.0)
  • Specular Tint: List (float, float, float)
  • Rim Light Scale: float (0.0 to 5.0)
  • Rim Light Tint: List (float, float, float)

"secondaryReflection" shader

Mirror subroutine fields:

  • Horizon Occlusion: float (0.0 to 4.0)
  • Secondary Intensity: float (0.0 to 1.0)
  • Secondary Intensity Color: List (float, float, float)
  • Secondary Fresnel: float (0.0 to 1.0)
  • Secondary Fresnel Color: List (float, float, float)

Blinn-Phong subroutine fields:

  • Horizon Occlusion: float
  • Secondary Gloss: float
  • Secondary Intensity: float
  • Secondary Intensity Color: List (float, float, float)
  • Secondary Fresnel: float
  • Secondary Fresnel Color: List (float, float, float)

GGX subroutine fields:

  • Horizon Occlusion: float (0.0 to 4.0)
  • Secondary Gloss: float (0.0 to 4.0)
  • Secondary Intensity: float (0.0 to 4.0)
  • Secondary Intensity Color: List (float, float, float)
  • Secondary Fresnel: float (0.0 to 1.0)
  • Secondary Fresnel Color: List (float, float, float)

Anisotropic subroutine fields:

  • Horizon Occlusion: float (0.0 to 4.0)
  • Secondary Gloss: float (0.0 to 4.0)
  • Secondary Intensity: float (0.0 to 4.0)
  • Secondary Intensity Color: List (float, float, float)
  • Secondary Fresnel: float (0.0 to 1.0)
  • Secondary Fresnel Color: List (float, float, float)
  • Direction Map: mset.Texture
  • Scale & Bias: bool
  • Swap X/Y Direction: bool
  • Anisotropy: float (0.0 to 1.0)
  • Anisotropy Direction: float (0.0 to 360.0)
  • Refraction Shift: float (-1.0 to 1.0)

Newton's Rings subroutine fields:

  • Thickness Map: mset.Texture
  • Strength: float (0.0 to 1.0)
  • Film Thickness (nm): float (1.0 to 39000.0)
  • Minimum Thickness (nm): float (1.0 to 39000.0)

"subdivision" shader

Flat subroutine fields:

  • Tessellation: float (0.0 to 2048.0)

PN Triangles subroutine fields:

  • Tessellation: float (0.0 to 2048.0)
  • Smoothing: float (0.0 to 1.0)

"surface" shader

Normals subroutine fields:

  • Normal Map: mset.Texture
  • Scale & Bias: bool
  • Flip X: bool
  • Flip Y: bool
  • Flip Z: bool
  • Object Space: bool

Detail Normals subroutine fields:

  • Normal Map: mset.Texture
  • Scale & Bias: bool
  • Flip X: bool
  • Flip Y: bool
  • Flip Z: bool
  • Object Space: bool
  • Detail Normal Map: mset.Texture
  • UV Set: int (0 or 1)
  • Scale & Bias;detail: bool
  • Flip X;detail: bool
  • Flip Y;detail: bool
  • Flip Z;detail: bool
  • Detail Tiling: float (1.0 to 40.0)
  • Detail Offset: float (0.0 to 1.0)
  • Detail Weight Map: mset.Texture
  • Channel;detail: int (0: R, 1: G, 2: B, 3: A)
  • Detail Weight: float (0.0 to 1.0)

Parallax subroutine fields:

  • Normal Map: mset.Texture
  • Scale & Bias: bool
  • Flip X: bool
  • Flip Y: bool
  • Flip Z: bool
  • Object Space: bool
  • Height Map: mset.Texture
  • Channel: int (0: R, 1: G, 2: B, 3: A)
  • Depth: float (0.0 to 0.5)
  • Depth Center: float (0.0 to 1.0)

"transparency" shader

Cutout subroutine fields:

  • Use Albedo Alpha: bool
  • Alpha Map: mset.Texture
  • Channel: int (0: R, 1: G, 2: B, 3: A)
  • Alpha: float (0.0 to 1.0)
  • Threshold: float (0.0 to 1.0)

Dither subroutine fields:

  • Use Albedo Alpha: bool
  • Alpha Map: mset.Texture
  • Channel: int (0: R, 1: G, 2: B, 3: A)
  • Alpha: float (0.0 to 1.0)

Add subroutine fields:

  • Use Albedo Alpha: bool
  • Alpha Map: mset.Texture
  • Channel: int (0: R, 1: G, 2: B, 3: A)
  • Alpha: float (0.0 to 1.0)
  • Tint: List (float, float, float)
  • Include Diffuse: bool

Refraction subroutine fields:

  • Index of Refraction: float (1.0 to 3.0)
  • Distant Background: bool
  • Use Microsurface: bool
  • Tint: List (float, float, float)
  • Albedo Tint: bool
  • Caustics: float (0.0 to 1.0)
  • Mask: mset.Texture
  • Channel;mask: int (0: R, 1: G, 2: B, 3: A)
  • Cutout: mset.Texture
  • Channel;cutout: int (0: R, 1: G, 2: B, 3: A)
  • Use Albedo Alpha: bool
  • Use Dither: bool

"extra" shader

Substance subroutine fields:

  • SubstanceFile

Custom subroutine fields:

  • ShaderFilePath
  • ReloadSeed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment