Creating own material nodes?

On my quest to play around with all the various things in UE4, now my sights have fallen on the material editor and, more specifically, the nodes. I want to see if I can make my own nodes, but after searching through the source code, I cannot seem to find where the actual functionality of the nodes is implemented. All I can find are the node “container” headers and implementation.

I have found some material on creating entire shaders/shader models, but preferably I would like to work on making snippets such as, say, the noise node. For this particular “quest,” I don’t want to rely on material functions (since my primary goal is to add new functionality, not extend on existing ones) or the custom node (since, let’s face it, the custom node is a major pain to work with).

1 Like

It is quite possible to do what you are asking. There is a documentation on the subject in

UnrealEngine/Engine/Documentation/Source/Programming/Rendering/MaterialExpressions/

Functionality of the nodes is implemented in HLSLMaterialTranslator

Alternatively, you could make a function in MaterialTemplate.usf and call it from the custom node.

There is absolutely nothing wrong with custom node, apart from being unable to return something larger than float4. ( be sure to vote here), so I have no idea what part of it is causing you so much pain.

1 Like

Thanks man! With the documentation and the HLSLMaterialTranslator class (and common.usf, which I was able to find thanks to the HLSLMaterialTranslator), I finally found the functionality I wanted to study.

The reason why the custom node is causing me pain to work with is because, well, let’s be fair here, the custom node doesn’t exactly make for a very user-friendly programming environment. No line numbers, size pretty much restricted to 200 pixels or so in width, you cannot use ctrl-f, scrolling isn’t all that intuitive if you use the scroll bar to the right, enter becomes shift-enter, among a few other gripes that are rather minor, but still annoy me to no end. That’s pretty much the reason I am not a big fan. I am aware it’s simply a limitation of it being a node (I know I cannot expect a fully fledged programming environment made specifically for one single node), but still.

1 Like

Erghh, trying to type in code in custom node must be a torture. Just copy/paste stuff in there from a program of your choice.

1 Like

Not necessary anymore. Already managed to make a simple random float today that worked like a charm in the material editor. Going to move into custom use files once I get a bigger handle on expression inputs and whatnot.

1 Like