Users have requested that light depth and light position are made available to Light Function Materials.
We seem to be calculating the per-pixel distance from the light to the surface in LightFunctionPixelShader.usf:
// Calculate radial view distance for stable fading float ViewDistance = length(View.WorldCameraOrigin - AbsoluteWorldPosition);
Users would like to have access to this value as an input in LightFunction materials in order to accomplish depth-based effects in light functions without incurring the additional cost of Blueprint or render target-based solutions described in these two UDN tickets:
https://udn.unrealengine.com/questions/529426/light-function-color-and-depth-features.html
The user in the second UDN ticket has found a way to access the ShadowMap and pass that into his light function instead as a halfway step, although I think a "LightDepth" Input node would have far more utility.
There currently is no clear way to get the light position from within the material itself. All options are flawed (list compiled thanks to [Link Removed] insights)
As the UDN user reports, the only working way so far is by passing the position with blueprints.
Why does the REMOVE method of map container remove elements have memory leaks?
How does TextureRenderTarget2D get TArray<uint8> type data?
How to delete some elements correctly when deleting an array loop?
What is the cause of the packaging error falling back to 'GameUserSettings' in ue5?
How do I set a material as a post-processing material?
What is the difference between Camera and CineCamera?
How does TArray loop correctly remove elements in blueprints?
How to implement springarm components to scale according to mouse position in spawn?
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-81813 in the post.