Building a Custom Node in Unitys Shader Graph @WorldOfZeroDevelopment
Building a Custom Node in Unitys Shader Graph  @WorldOfZeroDevelopment
Uploaded December 2018 | Updated November 2026, 2 days ago
With the introduction of Shader Graph Unity also added support for Custom Nodes you can build yourself by creating custom `CodeFunctionNode`. By extending this class we're able to create our own Nodes in Shader Graph that we can extend or implement in any way. In our example here we'll be creating a very simple linear interpolation between two colors, effectively reimplementing the existing `Lerp` or `Branch` nodes depending on what you are looking for.

The cool thing about this is it allows you to really easily extend Shader Graph with cool new functions, add missing features and more. I don't think this API is quite to the level of allowing you to add support for Tessellation or Geometry Shaders (that doesn't seem to be the goal here), instead it makes a somewhat accessible way for you to extend your tooling and help expand it.

That said, there are some issues here. Nodes that no longer compile are removed from the graph which feels a bit... awkward. And the default API relies on reflection to function completely. I feel like this could have been wrapped in many of the modern dependency injection style of models without requiring reflection as a significant part of the API. Still, it's nice to be available.

The code developed during this video is available here: gist.github.com/runewake2/68423db7c32d80993333a1c932f032d1

The official blog post on Shader Graph Custom Nodes can be found here: blogs.unity3d.com/2018/03/27/shader-graph-custom-node-api-using-the-code-function-node

Unity goes into even more depth on the CodeFunctionNode on their GitHub page: github.com/Unity-Technologies/ShaderGraph/wiki/Custom-Nodes-With-CodeFunctionNode

Join the World of Zero Discord channel: discord.gg/hU5Kq2u
Building a Custom Node in Unitys Shader GraphRuntime C# Scripting in Unity UI - The Roslyn Compiler in UnityUsing ContextMenu and ContextMenuItem in Unity 3DSwinging with the Asteroids VR Grappling Hook - Part 2Using Bash .bashrc and .profile Files to Initialize Your TerminalBuilding a Custom Dice Model with OpenSCADSpherical Gravity in UnityRotating the Flight Controller - Lets Make a Side Scrolling Shooter - Part 2Validate Unity Inspector Input with OnValidate - Quick TipRunning a Minecraft Server in DockerCreating a Context Menu in Custom Unity EditorsGetting Started with Pathfinding using Dijkstras Algorithm
World of Zero |

Building a Custom Node in Unity's Shader Graph

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER