Game Dev

Architecture

ArchViz

Material With Functions


A tutorial about how to use functions to create a layered material.

10 images :: Gold Coast :: 2020


image

Example Modern Sideboard

This is the example sideboard used for the tutorial about creating an optimised model.

image

The Material

Create a new material and tick Use Material Attributes in the Details Panel. This will allow the use of functions and layered materials.

Blend Node

This is where the Mask and Normal textures go in as well as the material layers. The Blend node itself connects to the Material Attributes node.

Overlay Normals and AO

Follow the 'baking' tutorial to see how to create these 2 textures.

The overlay AO is stored in the green channel of the Mask.

Material Layers

Up to 3 material functions can be plugged in here.
  • Layer 1 (no mask, default)
  • Layer 2 (Red channel)
  • Layer 3 (Blue channel, preferable metallic)

  • image

    Blend Node

    MF_3LayersSimple

    This node is a custom function. By default all layers are active and need a function plugged in. You can turn layers on and off with static bool parameters.

    You can also disable the overlay AO and Normals in cases you only need to use the masking of multiple materials. By default AO and Normals are on.

    When using a mirror activating the UseMirror feature will remove the Normal map from the blue masked layer to have a flat surface.

    The function has another Blend Node for blending the overlay with the material details. Below image shows the node setup.

    image
    image

    Overlay Blend Node

    MF_OverlayBlend

    This function blends the overlay normals and AO with the detail normals and AO of all the material layers.

    The node setup is shown in the below image.

    image
    imageimage

    Material Layer

    Left image:

    The function MF_GlossyWhite is displayed below as an example material function.

    Parameters will be passed through all functions if the name of the parameter and the name of the input are identical. Also put all parameters in a group that identifies the material layer clearly. It works very much like a normal material.


    image
    image

    Material Instance

    Creating a material instance will expose all variables from the material functions used.

    That's why it is important to use groups and exactly matching names for input and parameters. Any mistakes will show up in the instance as a missing parameter, having the wrong category or any changes won't have an effect. If that happens check the naming.

    Setting up a function is a bit more work than setting up a normal material. But once you have the function reusing it is just a matter of seconds.

    Unreal has another feature called "Layered Materials". It was put on hold previously so I do not know how reliable it is. It would work pretty much the same way but without having to create functions. The Mask can be used to create the layer blends.

    Top of page