While following the creation process for global shaders in a plugin ( Creating a New Global Shader as a Plugin in Unreal Engine | Unreal Engine 5.0 Documentation )
An essential step is left out. In StartupModule the Shader path has to be added using AddShaderSourceDirectory. Without that, the lines like here:
IMPLEMENT_SHADER_TYPE(, FLensDistortionUVGenerationVS, TEXT(“/Plugin/LensDistortion/Private/UVGeneration.usf”), TEXT(“MainVS”), SF_Vertex)
in the docs will not work, as the path is unknown. An example of how to do it is found in the LensDistortion.cpp