Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>UE4 Material Expression GeneratorNew to Visual Studio Code? Get it now.
UE4 Material Expression Generator

UE4 Material Expression Generator

David Morasz

|
2,090 installs
| (0) | Free
Generate Material Expression nodes from HLSL code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

UE4 Material Expression Node Generator

Features

Looks for float<N> main(...) function in the active document and generates a material expression node to the clipboard ready to be pasted in your UE4 material. Works great with the HLSL Preview extension.

float GlobalParam = 1;
float4 main(float2 uv : TEXCOORD0) : SV_Target0
{
    return 1;
}
  • Enter Generate UE4 Material Expression Node in command palette to copy an entire node to clipboard
  • Enter Generate text for UE4 Material Expression to copy only the expanded text to clipboard
    • (used for iterations)

this extension assumes that the main function is in global scope, its definition starts right at the beginning of line and the enclosing curly brackets are also both are the first characters on a line as seen above.

You can include other files in your code and this extension will recursively expand them for the expression node. Includes are always relative to their containing file.

// include.hlsl
#if !defined(include_hlsl)
#define include_hlsl 1

#define PI 3.141592653589793238

#endif

// main.hlsl
float GlobalParam = 1;
float4 main(float2 uv : TEXCOORD0) : SV_Target0
{
    #include "include.hlsl"
    return PI;
}

will result in

#if !defined(include_hlsl)
#define include_hlsl 1

#define PI 3.141592653589793238

#endif
return PI

Known Issues

It would be great if the extension would ask for function name instead of being hard coded.

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft