Menu
Lumberyard
User Guide (Version 1.14)

Procedural Material Nodes

Lumberyard supports Allegorithmic Substance for working with procedurally-generated materials. Procedural materials are materials in which you can modify their textures during runtime.

You can use the Allegorithmic Substance Designer to author procedural materials and then import them into Lumberyard Editor. You can then use the Script Canvas editor or Lua to modify the procedural material's textures at runtime.

To enable this feature, you must enable the Allegorithmic Substance gem. For more information, see Using Gems to Add Modular Features and Assets.

For more information, see Working with Substances and Lumberyard Substance Integration.

To work with procedural materials in scripts

  1. Reference the procedural material file

    To reference the procedural material, use the Find by Name or Find by Name and Index node.

  2. Modify the parameter values for the procedural material

    Use the Set Input <Type> nodes to modify the parameter values for the procedural material. The values that you specify in the nodes modify the parameters that update the procedural material's textures. You can modify parameters for multiple procedural materials in a single frame.

    Note

    Input parameters are the parameters that you modify for the procedural material. You can find the parameters for a material in the Substance Editor. For example, the sample procedural material brickWall_04 has input parameters such as Age, Mortar, and Depth.

    To modify these input parameters during runtime, specify the parameter name and its value in a node such as Set Input Number.

  3. Render the procedural materials

    After you specify the changes that you want, use the Render Asynchronous or Render Synchronous node to update the procedural material's texture. The render node applies to all procedural materials in which their parameters have changed, so at most, call a render node once per frame.

Example

The Allegorithmic Substance gem includes a sample procedural material named brickWall_04. You can import this file into Lumberyard and write a script that dynamically changes the Age and Mortar input parameter values, so that the wall appears to erode over time.


                Brickwall procedural material that shows erosion and aging over
                    time.

See the following example script to enable this effect.


            Example Script Canvas script that shows the erosion for a brick wall.
  1. The Find by Name and Index node (1) retrieves the brickWall_04 procedural material and sends the material to all Set Input Number nodes (3, 4, 6, 7).

  2. The Duration node (2) runs the aging process for four seconds through the Out pin, which is triggered every frame. The node finalizes the aging process through the Done pin.

  3. The first Set Input Number node (3) transitions the Age parameter from 0 to 0.5 over four seconds.

  4. The second Set Input Number node (4) transitions the Mortar parameter from 0 to 1 over four seconds.

  5. The Render Asynchronous node (5) applies these changes to the procedural material's textures.

  6. For the Duration node (2), the Done pin triggers one last update with the final Age value of 0.5 (node 6) and the Mortar value of 1.0 (node 7).

  7. With the Force parameter enabled, the Render Asynchronous node (8) applies these changes to the procedural material's textures.

    Note

    Steps 6 and 7 are not always required, but are examples of how you can use the Render Asynchronous node's Force parameter to guarantee that a final update is applied. For more information, see Render Asynchronous.