Skip to content

Custom master materials

Material Smith can make its material instances children of any material or material instance. It needs to know which texture parameter takes which map and which static switch turns a map on. That mapping is called a master profile.

  • Panel: Options > Master. The line under the picker shows the inputs Material Smith found.
  • Project Settings: Plugins > ta Material Smith > Master Material > Default Master. This becomes the panel’s Master when the panel opens, and the master of get_default_options() in Python.
  • Python: set options.master before create_material_instances. See Python.

If the picked material is M_Smith_Standard, a copy of it or an instance of it, Material Smith recognizes it by its Packed AO Channel and Packed Roughness Channel parameters and fills it like the Material Smith master. Everything on this page is about other materials.

Without a saved profile, Material Smith reads the names of the master’s texture parameters and static switch parameters and guesses the mapping from them.

  1. The name is simplified: only letters and digits are kept, in lowercase, and the endings texture, sampler, param, map and tex are removed from the end as long as at least two characters remain. Base Color Map becomes basecolor, NormalTex becomes normal, MRA_Mask becomes mramask.
  2. Names that contain detail are ignored.
  3. The simplified name is compared with the keywords of each map. A name that equals a keyword scores higher than a name that only contains one; partial matches only count for keywords of three or more letters. Earlier keywords score higher than later ones.
  4. The best scores are assigned first. Each parameter is used for at most one map, and each map gets at most one parameter.
Map Keywords, in order
Base Color basecolor, albedo, diffuse, basecolour, color, colour, diff, base, bc, d
Normal normal, nrm, norm, nor, n
Packed (ORM …) orm, arm, mra, rma, rmao, mrao, occlusionroughnessmetallic, packed, masks, mask, ordp, ord
Roughness roughness, rough, r
Metallic metallic, metalness, metal, m
Ambient Occlusion ambientocclusion, occlusion, ao
Emissive emissive, emission, emit, glow, e
Opacity opacitymask, opacity, alpha, transparency
Height height, displacement, disp, bump, parallax

Only switches whose simplified name starts with use, enable or has are considered. That word is removed and the rest is scored with the same keywords. Each map that has a texture parameter gets the best scoring switch, and every switch is used once. UseNormal and Use Normal Map both become the switch of the normal map.

The channel order of the packed texture comes from the name of the packed parameter:

Parameter name contains Red Green Blue Alpha
mra Metallic Roughness Ambient Occlusion Empty
rma Roughness Metallic Ambient Occlusion Empty
ord Ambient Occlusion Roughness Height Empty
anything else Ambient Occlusion Roughness Metallic Empty

A master with the texture parameters Albedo, NormalTex and MRA_Mask and the static switch UseNormal is read as:

Input Guess
Albedo Base Color
NormalTex Normal
MRA_Mask Packed, channels Metallic, Roughness, Ambient Occlusion
UseNormal Switch of the normal map

Names such as BaseColorMap or T_Diffuse are read as base color too.

The line under Options > Master lists the mapping, for example Guessed inputs: Base Color: Albedo, Normal: NormalTex (switch UseNormal), … Edit them in Project Settings > Master Profiles (saved there when you create instances). Once a profile is saved it says Saved inputs instead.

  1. Pick the master in Options > Master and read the line under it.

  2. Click Create. The panel saves the guessed profile to Project Settings > Plugins > ta Material Smith > Master Material > Master Profiles before it creates the instances.

  3. If a guess is wrong, correct the entry in Master Profiles. The next run uses the saved profile.

From Python, a guessed profile is used but not saved; call save_master_profile(get_master_profile(material)) to store it.

Each entry of Master Profiles has these fields:

Field Meaning
Material The master material.
Texture Parameters Which texture parameter receives each map. Leave a map out if the master has no input for it.
Switches Optional. The static switch that is turned on when the map is found and off when it is missing.
Packed Red, Packed Green, Packed Blue, Packed Alpha The channel layout the master expects in its packed texture. Defaults: Ambient Occlusion, Roughness, Metallic, Empty.
  • Every map of the set that has a texture parameter in the profile is assigned to it. A map without one is reported, for example The master has no Emissive input, so T_Screen_Emissive is not used.
  • Every switch in the profile is turned on when its map was assigned and off otherwise.
  • Texture settings are fitted to the sampler type of each parameter as it is set in your material. See Texture settings.
  • The blend mode and Two Sided overrides work as with the Material Smith master: with Blend mode on Auto, a set whose opacity map (or packed texture with an opacity channel) is assigned to the master gets a Masked override.

These features only exist for the Material Smith master: the glossiness switch, Parallax for height maps and the packed channel selectors. With a custom master, a glossiness map is only inverted when it is packed into a packed texture.

If the profile has a packed texture parameter, Material Smith compares the set with the profile’s channel layout. Packing is needed when:

  • the set’s packed texture has a different channel order than the master reads, for example T_Rock_ORM for a master with an MRA input, or
  • the set has a separate map for one of the packed channels, and the master has no own parameter for that map.

With Pack channels off, the preview warns, for example The master expects one packed MRA texture. Turn on Pack channels to combine the maps. A packed texture with the wrong order is still assigned, with the warning T_Rock_ORM is packed as ORM, but the master reads MRA.

With Pack channels on, Material Smith creates a texture in the master’s channel order in the texture folder and assigns it instead. Its name is the first Texture Prefix, the set name and a suffix for the layout: Packed Texture Suffix (ORM) for the ORM layout, otherwise MRA, RMA, ORD, or Packed for any other order. T_Rock_ORM is repacked into T_Rock_MRA; the original texture is kept. Each channel comes from the separate map if the set has one, otherwise from the matching channel of the existing packed texture, otherwise it gets a default value. See Channel packer for the output settings.

Unreal checks the default texture of every texture parameter against the parameter’s sampler type, even when an instance overrides the texture. If a parameter of your master has a default texture that doesn’t fit, for example an sRGB color texture on a Masks parameter, no instance of that master can compile.

Material Smith checks this for every parameter it fills and warns: The default texture of the master’s ‘ORM’ parameter does not fit its Masks sampler, so instances will not compile. Give the parameter a fitting default texture. Fix it in the master: give the parameter a default texture with settings that match its sampler type, for example a linear texture with Masks compression for a Masks parameter.

Warning Cause
The master has no texture parameter named ‘…’. A profile entry names a parameter that doesn’t exist in the master. Correct it in Master Profiles.
… is used by a … sampler, which Material Smith cannot set up The parameter uses a sampler type other than Color, Linear Color, Normal, Masks, Grayscale, Linear Grayscale, Alpha or their virtual texture versions. The texture is assigned but its settings are not changed.
Could not load the master material … The picked master could not be loaded.