Post Process: How to Absolute World Position at UV

For those still looking for a solution for UE5, I implemented the following code inside a custom node that I used for the edge detection algorithm (it worked well for my task):

#if POST_PROCESS_MATERIAL
    if (ClampUV){
        UV = saturate(UV);
    }
    
    // Clip space
    float4 Clip;
    Clip.x = UV.x * 2.0 - 1.0;  // maps [0:1] to [-1:1]
    Clip.y = (1.0 - UV.y) * 2.0 - 1.0;  // maps [0:1] to [1:-1]
    Clip.z = LookupDeviceZ(ViewportUVToBufferUV(UV));  // Normalised Depth in range [0:1]
    Clip.w = 1.0;


    // Translated World Space
    float4 WorldPos = mul(Clip, ResolvedView.ClipToTranslatedWorld);

    // Translated to absolute world
    return DFFastSubtract(WorldPos.xyz/WorldPos.w, PrimaryView.PreViewTranslation).High;
#else
    return 0;
#endif

This is the material function:

Use the following snippet to copy and paste the blueprint code.