Custom Code Sample
This material graph sample demonstrates how to create and use nodes containing a custom shader code.
Albedo RGB value for the material of the Opaque PBR type is specified directly using a Float node (casting to float3 is performed automatically).
The Function node has two float input ports (A and B) and two float output ports (return value Out and C output). They are automatically added according to the function signature:
float function_1(in float a, in float b, out float c)
{
c = lerp(a, b, 0.5f);
return a+b;
}
A and B values for the custom function node are provided by Slider parameter nodes (adjustable via the Parameters panel in the UnigineEditor) connected to it.
The result of linear interpolation between A and B values is connected to the roughness input port of the master material node, while the sum of A and B - to metalness.
Finally, the data output is passed to the Final node.