HLSL(.fx) to UE4 Material - porting advice?

I have a great many HLSL.fx shaders that I have written collected and purchased over the last 5 years.
I would like to make use of them as much as possible, but there doesn’t seem to be any porting advice as yet.

So far, I am aware that use of Custom Expressions are discouraged for performance and portability reasons.
I am also aware that multi-pass shaders are not an option, which is ok as most of my shaders are single-pass.
As such, I am wondering how I can reuse some of my 3rd party shaders within UE4.

For example,
Consider this NVidia Perlin Noise shader:
…and imagine you already have it working (in some other graphics engine) as a compilable .fx file.

How would one go about porting that PerlinNoise.fx code to UE4 for use as a material effect?

(a) Use UE4 material nodes & functions to replicate the .fx code?
(b) Use Custom Expressions? (come with caveats!)
(c) Use FVertexFactory? (no idea if they are appropriate let alone how to use them!)
(d) Custom Plugin? (if possible, a basic tutorial example would be helpful)
(e) USF shader approach?

I am not looking for a ‘perlin noise shader’. I am purely interested in the possible workflow for
[PixelShader.fx] → [Unreal Engine 4 material] so the generic process can be adapted for any shader.

In most cases it would be (a). If you are finding it impossible to achieve it with (a), an example would be a multi pass pixel shader then you might have to write your own usf shader file.

Do you know if usf shaders come with the same caveats as custom (hlsl) expressions?

No they dont, USF are the native shader formats for UE4. Everything shader based are in USF’s. ie the Material template is a USF (Which is just HLSL)

Excellent. That’s good to know!

Time to start hunting down USF documents.

The easiest way is probably to convert your HLSL into a function format (instead of a main entrypoint), paste it into MaterialTemplate.usf. Then use a Custom expression to call your function, and hook up the output however you want into the material system. Any inputs your code needs will have to be function parameters.

“Then use a Custom expression to call your function”

That sounds like an interesting idea, but I am again concerned about the Custom expression caveats:

Also, can I assume there is no documentation on the MaterialTemplate.usf that can help me with this scenario?
(or am I the only madman attempting it?!)