Skip to content

Instantly share code, notes, and snippets.

@num3ric

num3ric/tutorial.md

Last active May 17, 2016
Embed
What would you like to do?
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