How long until the 'Custom' Material Editor node works?

We’re highly restricted to using nodes at the moment, I really want to implement some custom HLSL code into my materials and the lack of the Custom node is really starting to hit me on my project.

How long until it’s added back in properly? Failing that, is there a way I can dive straight in and add it via the source code? For those that are curious, I’m working on some complex Atmospheric Shaders.

What are you talking about? There is custom node and it’s working, but you need to type in HLSL (or else you use OpenGL, but i’m not 100% sure how cross compiling works) and it’s a single function, code inside it will be pasted to the function, so you can’t type in whole code with custom functions in it

The Custom node isn’t working for me, I’m typing in HLSL, requesting inputs and I get nothing. I don’t even get a text box popping up to let me enter any code whatsoever.

Bump. Still no code window to input HLSL!

Here’s an Answerhub post from Beta that shows it still isn’t working (confirmed by a dev)

Here’s a future post suggesting how to use it, but that text editor window still isn’t there!

Yet another Answerhub post showing how it doesn’t work.

No way to write shaders in pure HLSL without diving very deep into the source code (and likely result in breaking things) is pretty detrimental to the editors flexibility right now if you ask me!

Another bump, still not much word on this.

Hey TheJamsh -

The Material Editor’s Custom node does work with some limitations. Of course the biggest being that you cannot edit the code in the single line input currently. However you can code in visual studio or notepad and copy paste into that single line and everything should work as long as you setup your inputs correctly with the correct variable names. Another big drawback currently is that you cannot do any loops inside the custom node. We are working toward improving the functionality of the node in coming versions of the engine. Is there a particular HLSL implementation that you are looking to accomplish and I can see if we can track a way to do it for you.

Thanks Eric, basically what I’m trying to do is create a simple Gradient Mapper, based on this example

In UE3 clicking on the code entry box would bring up a small text window where I could easily input multiple lines of text, but in UE4 no such window appears. I would like to do it with nodes if possible, but I imagine doing it in HLSL is slightly quicker in this case and would prevent having a hella-lot of nodes in an already fairly busy material.

Thanks for the heads up about copy-paste, I’ll give that a try and see if it’s a good workaround for now :slight_smile:

Edit:
I get this error when plugging in the following code:

[SM5] Warning X3202: signed/unsigned mismatch, unsigned assumed
[SM5] error X3004: undeclared identifier ‘ControlTexChannel’



float3 output;

const uint NUMCOLORS = 8;

float4 gradient[NUMCOLORS];
gradient[0] = color1;
gradient[1] = color2;
gradient[2] = color3;
gradient[3] = color4;
gradient[4] = color5;
gradient[5] = color6;
gradient[6] = color7;
gradient[7] = color8;

float4 blend1 = gradient[0];
float4 blend2 = gradient[0];
float3 weight;
float singleWeight = 0;

for (int i = 0 ; i<NUMCOLORS-1; i++ )
{ 
 if (gradient*.a <= ControlTexChannel)
  {

    blend1 = gradient*;

    if (i == NUMCOLORS-1)
   {
    blend2 = gradient*;
    }
    else
    {
    blend2 = gradient[i+1];
    }
   }
}

singleWeight = (ControlTexChannel- blend1.a)/(blend2.a - blend1.a);
weight = float3(singleWeight,singleWeight,singleWeight);

output = lerp( blend1.rgb, blend2.rgb, weight);

return output;


I’m guessing that FOR loop is exactly the kind of thing I can’t do in code? Is there a way I could create a node like this in Source Code, so it really is a completely custom node?

Edit 2
Cancel that… just me being stupid and missing an Input.