Shader preprocessor macros - define custom vector?

Hey so I’ve seen lines like this in shaders, where you can define basically compilation constants:

#define MY_CUSTOM_CONSTANT 2.940386

I was wondering if I could do the same, but with a vector? Maybe something like…

#define MY_CUSTOM_FLOAT4 float4(0.2, 0.4, 0.6, 1)

Ah silly me! I was right – I tested it and it actually worked! There’s just not a lot of documentation on some shader topics, so hopefully this helps someone else too. My example from above works:

#define MY_CUSTOM_FLOAT4 float4(0.2, 0.4, 0.6, 1)

And also here are some other examples that also worked – it’s good with basically any simple Cg/HLSL data type like booleans, integers, and matrices! (I didn’t need to try defining any samplers/textures cause those would usually not be constant, or I would want to be able to set from a material via C#/inspector anyway)

#define DEFAULT_NORMAL float3(0, 0, 1)
#define DEFAULT_NORMAL_COLOR float4(0.5, 0.5, 1, 1)
#define TEST_BOOLEANS bool2(true, true)
#define SOME_UNSIGNED_INTEGER uint(49)
#define JUST_A_SYMBOL