Custom Material Node

Creation of Material

First of all, create a material. Use ADD NEW button which is at top left corner of content browser window or access it via right click in empty area of content browser and choose it from component menu.

Changing the Material Domain

  • Open the material.

  • Change the material domain as REALITY NODE from material section which is inside of details panel. (The details panel located left bottom of material editor.)

  • Apply and save changes.

Coding the Material

In this tutorial we will show changing color of material as example. There are two ways to add material node to the graph:

First Method:

  • Click the empty area of material graph. Select node.

  • Select the node from palette which is at right of material editor, drag and drop to the graph.

Let's code the material.

  • Add a TEXTUREOBJECTPARAMETER node.

  • Add a TEXTURESAMPLE node.

  • Add a VECTORPARAMETER node.

  • Add a MULTIPLY node.

  • Link them as shown in below image.

Material Definition for Reality

  • Click the ADD NEW button.

  • Hover mouse cursor on Reality then select "MaterialDefinition".

  • Open MaterialDefiniton class.

  • Add two parameters. Example has two parameters. TEXTUREOBJECTPARAMETER and VECTORPARAMETER

  • Click the plus icon then select type of parameters.

  • Set properties of parameters.

The has to same with parameter name of material nodes.

  • Open the passes section which under parameters section.

In this section inputs passes to output. If you don't define pass parameters the inputs changes would not apply on output.

  • There were 2 inputs. TEXTUREOBJECTPARAMETER and VECTORPARAMETER. Set them in this section to apply as result.

  • Set material.

  • Add parameters as output. Save changes.

Exporting to Reality

  • Open project settings from EDIT → PROJECT SETTINGS

  • Open Exports tab under Reality title.

  • Add an element to the array in the Material Definitions tab under the Material Nodes.

Setup in Reality

  • Click to PLAY button.

  • Open Reality Setup.

  • Right click an empty area then hover on CustomCategory. (This comes from MaterialDefinition class. We set it under Category Name.)

  • Add custom material node.

  • Set your graph as shown in below image. We use CAMERA for texture input.

  • Click on properties tab of the MYCUSTOMMATERIAL node.

  • Change color value from properties menu.

Let's check the result.

Last updated