Skip to content

Instantly share code, notes, and snippets.

@num3ric
Last active May 17, 2016 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save num3ric/82e0b4d64a7599356d0c6d93d64ade26 to your computer and use it in GitHub Desktop.
Save num3ric/82e0b4d64a7599356d0c6d93d64ade26 to your computer and use it in GitHub Desktop.
UE4 custom material nodes

Primer on how to use multiple custom material nodes in Unreal Engine 4

Create three custom nodes as follows:

Material Node Graph

SinewaveCustom (with output type CMOT Float 1)

//It is possible to use macros to define convenience local functions
#define SINENORM( arg ) 0.5 * ( sin( arg ) + 1.0 )
return SINENORM( Time );

RandCustom (with output type CMOT Float 1)

return frac( sin( dot( Coord.xy ,float2(12.9898,78.233) ) ) * 43758.5453 );

RootCustom (with output type CMOT Float 3)

float s = CustomExpression0( Parameters, Time );
float r = CustomExpression1( Parameters, Coord );
return clamp( s + r, 0.0, 1.0 );

Make sure to link the two first nodes as inputs to the root, as seen above. In this way, they will be included in the compiled final shader as CustomExpression0 and CustomExpression1 respectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment