SF
STS Forge

Materials

Material and MaterialInstance verbs: mat-list-expressions, mat-add-expression, mat-connect, mi-set-param, and more.

Back to AI Guide

Verbs for editing Material expression graphs and setting parameter overrides on MaterialInstanceConstant assets. Material graph verbs operate on expression indices (integers) rather than GUIDs.


Material graph verbs (7)#

mat-list-expressions#

List all expressions in a Material asset.

Category: Read

Arg Required Description
-asset= Yes Material asset path

Examples:

-verb=mat-list-expressions -asset=/Game/Materials/M_Base

mat-add-expression#

Add an expression node to a Material graph.

Category: Write (material)

Arg Required Description
-asset= Yes Material asset path
-class= Yes Expression class (short name or full suffix, e.g., ScalarParameter, VectorParameter, TextureSample, Multiply, Add, Constant, Lerp)
-posX= No X position
-posY= No Y position
-name= No Parameter name (for parameter expressions like ScalarParameter, VectorParameter)

Examples:

-verb=mat-add-expression -asset=/Game/Materials/M_Base -class=ScalarParameter -name=Roughness -posX=0 -posY=0
-verb=mat-add-expression -asset=/Game/Materials/M_Base -class=VectorParameter -name=BaseColor -posX=0 -posY=200
-verb=mat-add-expression -asset=/Game/Materials/M_Base -class=TextureSample -posX=-400 -posY=0
-verb=mat-add-expression -asset=/Game/Materials/M_Base -class=Multiply -posX=-200 -posY=100
-verb=mat-add-expression -asset=/Game/Materials/M_Base -class=Lerp -posX=-200 -posY=300
-verb=mat-add-expression -asset=/Game/Materials/M_Base -class=Constant -posX=-400 -posY=200

Notes:

  • -name= is only meaningful for parameter expression types (ScalarParameter, VectorParameter, TextureParameter). It is ignored for non-parameter types like Multiply or Constant.
  • The returned expression index is used by mat-connect, mat-connect-property, and mat-delete-expression.

mat-connect#

Connect two material expression outputs to inputs.

Category: Write (material)

Arg Required Description
-asset= Yes Material asset path
-srcExpression= Yes Source expression index (integer)
-dstExpression= Yes Destination expression index (integer)
-srcOutput= No Source output pin name (defaults to first/empty)
-dstInput= No Destination input pin name (defaults to first/empty)

Examples:

# Connect expression 0 output to expression 1 input (both default pins)
-verb=mat-connect -asset=/Game/Materials/M_Base -srcExpression=0 -dstExpression=1

# Connect specific pins
-verb=mat-connect -asset=/Game/Materials/M_Base -srcExpression=0 -dstExpression=2 -srcOutput=RGB -dstInput=A

mat-connect-property#

Connect an expression to a material property input (e.g., BaseColor, Roughness).

Category: Write (material)

Arg Required Description
-asset= Yes Material asset path
-expression= Yes Expression index (integer)
-property= Yes Material property name (see supported values below)
-output= No Expression output pin name (defaults to first)

Supported property values: BaseColor, Metallic, Specular, Roughness, Normal, EmissiveColor, Opacity, OpacityMask, WorldPositionOffset, AmbientOcclusion, SubsurfaceColor

Examples:

# Wire a VectorParameter to BaseColor
-verb=mat-connect-property -asset=/Game/Materials/M_Base -expression=0 -property=BaseColor

# Wire a ScalarParameter to Roughness
-verb=mat-connect-property -asset=/Game/Materials/M_Base -expression=1 -property=Roughness

# Wire the RGB output of a texture sample to Normal
-verb=mat-connect-property -asset=/Game/Materials/M_Base -expression=3 -property=Normal -output=RGB

mat-delete-expression#

Delete a material expression by index.

Category: Write (material)

Arg Required Description
-asset= Yes Material asset path
-expression= Yes Expression index (integer)

Examples:

-verb=mat-delete-expression -asset=/Game/Materials/M_Base -expression=2 -save

Notes:

  • Connections involving the deleted expression are broken automatically.
  • Expression indices of remaining nodes may shift after deletion. Use mat-list-expressions to get updated indices.

mat-recompile#

Recompile a material and its shaders.

Category: Write (material)

Arg Required Description
-asset= Yes Material asset path

Examples:

-verb=mat-recompile -asset=/Game/Materials/M_Base

Notes:

  • Use after making structural changes (adding/removing expressions, changing connections) to ensure shader compilation is up to date.
  • Recompilation can take several seconds for complex materials.

MaterialInstance verbs (2)#

mi-list-params#

List all parameter overrides on a MaterialInstanceConstant.

Category: Read

Arg Required Description
-asset= Yes MaterialInstance asset path

Examples:

-verb=mi-list-params -asset=/Game/Materials/MI_Base_Red

Output:

{
    "success": true,
    "parameters": [
        { "name": "BaseColor", "type": "vector", "value": "(R=1.0,G=0.0,B=0.0,A=1.0)" },
        { "name": "Roughness", "type": "scalar", "value": "0.4" },
        { "name": "UseDetail", "type": "staticswitch", "value": "false" }
    ]
}

mi-set-param#

Set a parameter value on a MaterialInstanceConstant.

Category: Write (material instance)

Arg Required Description
-asset= Yes MaterialInstance asset path
-name= Yes Parameter name
-value= Yes Value string (see format table below)
-paramType= No Force type: scalar, vector, texture, staticswitch. Auto-detected if omitted.

Value formats by type:

Type Format Example
scalar Decimal number "0.5"
vector UE struct text "(R=1.0,G=0.5,B=0.0,A=1.0)"
texture Asset path "/Game/Textures/T_Rock_D"
staticswitch Boolean string "true" or "false"

Examples:

# Set a scalar parameter
-verb=mi-set-param -asset=/Game/Materials/MI_Base_Red -name=Roughness -value=0.8 -save

# Set a vector (color) parameter
-verb=mi-set-param -asset=/Game/Materials/MI_Base_Red -name=BaseColor -value="(R=0.2,G=0.4,B=1.0,A=1.0)" -save

# Set a texture parameter
-verb=mi-set-param -asset=/Game/Materials/MI_Base_Red -name=DiffuseTexture -value=/Game/Textures/T_Metal_D -save

# Set a static switch parameter
-verb=mi-set-param -asset=/Game/Materials/MI_Base_Red -name=UseDetail -value=true -save

# Force type detection when auto-detection fails
-verb=mi-set-param -asset=/Game/Materials/MI_Base_Red -name=Emissive -value=1.0 -paramType=scalar -save

Notes:

  • Type is auto-detected from the parent material's parameter definitions when -paramType= is omitted.
  • Use -paramType= when the parameter name is ambiguous or the auto-detection picks the wrong type.

Batch example: create a material with expressions wired to properties#

Build a PBR material from scratch with ScalarParameter and VectorParameter nodes connected to material property inputs, all in a single commandlet launch.

{
    "defaultAsset": "/Game/Materials/M_NewPBR",
    "operations": [
        {
            "verb": "mat-add-expression",
            "args": { "class": "VectorParameter", "name": "BaseColor", "posX": "-400", "posY": "0" },
            "id": "basecolor"
        },
        {
            "verb": "mat-add-expression",
            "args": { "class": "ScalarParameter", "name": "Metallic", "posX": "-400", "posY": "200" },
            "id": "metallic"
        },
        {
            "verb": "mat-add-expression",
            "args": { "class": "ScalarParameter", "name": "Roughness", "posX": "-400", "posY": "400" },
            "id": "roughness"
        },
        {
            "verb": "mat-add-expression",
            "args": { "class": "TextureSample", "posX": "-600", "posY": "600" },
            "id": "normaltex"
        },
        {
            "verb": "mat-connect-property",
            "args": { "expression": "$basecolor.expressionIndex", "property": "BaseColor" }
        },
        {
            "verb": "mat-connect-property",
            "args": { "expression": "$metallic.expressionIndex", "property": "Metallic" }
        },
        {
            "verb": "mat-connect-property",
            "args": { "expression": "$roughness.expressionIndex", "property": "Roughness" }
        },
        {
            "verb": "mat-connect-property",
            "args": { "expression": "$normaltex.expressionIndex", "property": "Normal", "output": "RGB" }
        },
        { "verb": "mat-recompile" }
    ],
    "save": true
}

This creates four expression nodes (BaseColor vector parameter, Metallic scalar parameter, Roughness scalar parameter, and a texture sample for the normal map), wires each to the corresponding material property input, recompiles shaders, and saves the asset.


Tips#

  • Use mat-list-expressions before writes. Expression indices can change after adding or deleting nodes. Always refresh the index list before connecting or deleting.
  • Batch for multi-step material edits. Each commandlet launch loads the full editor. Use batch operations to avoid repeated 30-60 second startup costs.
  • mat-recompile after structural changes. Adding expressions or changing connections requires recompilation to update shaders.
  • mi-set-param for instance variation. Create MaterialInstances from a parent Material, then use mi-set-param to override specific parameters without duplicating the entire material graph.