About Shader Graph Plus
Shrimple fork of shadergraph with some extra bits and bobs.
Custom Node Examples
C# Based Node
namespace Editor.ShaderGraphPlus.Nodes;
[Title( "My Custom Node" ), Category( "Custom" ), Icon( "invert_colors" )]
public class MyCustomNode : ShaderNodePlus
{
public static string MyCustomFunction => @"
float3 MyCustomFunction( float3 vColor )
{
return float3( 1.0 - vColor.r, 1.0 - vColor.g, 1.0 - vColor.b );
}
";
[Input( typeof( Vector3 ) )]
[Hide]
public NodeInput Color { get; set; }
[Output( typeof( Vector3 ) )]
[Hide]
public NodeResult.Func Result => ( GraphCompiler compiler ) =>
{
string func = compiler.RegisterFunction( MyCustomFunction );
string funcCall = compiler.ResultFunction( func, $"{compiler.ResultOrDefault( Color, Vector3.One )}" );
// Avalible Result Types
/*
ResultType.Bool
ResultType.Float
ResultType.Vector2
ResultType.Vector3
ResultType.Color
ResultType.Float2x2
ResultType.Float3x3
ResultType.Float4x4
ResultType.Sampler
ResultType.TextureObject
*/
return new NodeResult( ResultType.Vector3, funcCall );
};
}
Custom Function
Source