I’m trying to figure out the best IDE setup to develop external shader files while having proper autocompletes and syntax highlighting and I’m struggling with this a bit.
The include shader file paths are not full, e.g. WorldSpaceMath.ush has these includes:
#include "/Engine/Private/DoubleFloat.ush" #include "/Engine/Private/LargeWorldCoordinates.ush"which don’t contain the ‘Shaders’ folder. From what I understand, this folder gets linked later, which makes it all work, but this makes IntelliSense not work in Visual Studio as it can’t find the files.
In Rider the paths get resolved, however Rider does not provide any syntax highlighting for conditionally uncompiled code, which can make a lot of the functions invisible and hard to work with (e.g. WorldSpaceMath.ush providing a standardized way of working with LWC/DF values is fully greyed out due to #IF WSVECTOR_IS_TILEOFFSET / #elif WSVECTOR_IS_DOUBLEFLOAT
Do you have any recommendations for how to better handle this? Are there any interal Epic practices/setups for IDE setup when doing non-materialgraph shader work?
The best IDE setup for shader development is somewhat subjective, currently these are some of the common tools:
Visual Studio with the “HLSL Tools for Visual Studio” or similar extension set up to handle .usf/.ush files. In practice, while this may provide syntax highlighting and sometimes Go to definition works, it doesn’t always, especially when the include paths start with “/”.
Visual Studio with the .usf/.ush file extensions set to use the c++ editor and the VS Chromium extension for search/navigation.
Rider, but iterate by manually setting the missing permutations and environments.
10x editor (popular choice) seems to have pretty good Go to definition, fast text search and working syntax highlighting including for conditionally compiled code.
I’m curious to hear what other IDEs/Extensions developers are using for shader development!
[mention removed] Thank you for the answer! I will definitely try out 10x to see how it feels
Additionally, I have found a workaround for Rider mentioned here.
You can use this snippet to have IDE-time only defines, which helps to set specific permutations without affecting the actual shader logic when it’s run in the engine:
#ifdef __RESHARPER__ // __RESHARPER__ is only defined while in IDE. Used to help editing this file with proper highlighting. #define PLATFORM_ANDROID #endif