I am trying to customize how lights are calculated into the scene similar to this shader file in Unity (basically trying to re-create the whole shader in UE4):
Line 26 at
It looks like that this cannot be achieved in PostProcess or Material since it is manipulating lighting calculation directly. I tracked all the way down and found ForwardLightingCommon.ush which seems to be the right place to make this kind of modification.
I tended not to directly change this file since changing directly on the Engine source code is always not the best option. I wonder if there is anyway to override this file. I found some articles saying about cutome shader files and hlsl files but they seem only work for Custom nodes for material editor.
Is there any option other than modifying this file directly?
There is no such thing as good practice trying to modify engine files, my suggestion is to create a fork from github and then modify the files as much as you please with your custom version.
Related to your topic, the place you are looking for to modify the light attenuation is inside the DeferredLightingCommon.ush, look at the function GetDynamicLightingSplit. I see you are trying to do some sort of toon effect, check this link, it might help, a bunch of dudes are supporting a toon shading model for UE.