Extending Custom HLSL / Custom Expressions

Awesome, it works thanks!!

It would still be awesome if we could just add the include in one custom node and use the functions in the others like this…

Unfortunately it doesn’t work!

Code of the structure it’s just:


#pragma once
struct IacopoHlslFunctions
{
    float3 OrangeBright()
    {
        return float3(1, .7, 0);
    }
};    

IacopoHlslFunctions iacopoHlslFunctions;

I would expect the iacopoHlslFunctions variable to be added to the scope of the material, apparently it’s not.

This other code works fine, but every time you use a custom node (in the same material) you need to re-include the file, which I don’t understand why.


#include "/Engine/Private/iacopoHlslStructures.ush"
return iacopoHlslFunctions.OrangeBright();